服务器到期新买了一台服务器,记录一下重新安装基本环境碰到了一些问题

安装nginx

1. 启动失败

403 forbidden nginx

解决方案:(个人使用直接用了root账号,修改对应nginx启动用户)

  • vi conf/nginx.conf
  • user 改成对应用户

2. 重启失败

1
2
3
4
5
6
7
8
9
/var/log/nginx 日志文件:
nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Address already in use)
nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Address already in use)
nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
nginx: [emerg] still could not bind()

解决方案:杀死80端口nginx程序重新启动:

  • lsof -i :80 (发现是nginx在占用)
  • kill [pid]

mysql启动卡在启动命令、或者InnoDB: mmap(137363456 bytes) failed; errno 12

一半是内存过小,centos没有设置swap分区可以通过swap解决

大专栏  linux中nginx、mysql安装碰到的问题>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
cat /var/log/mysqld.log 日志:
2019-01-14 23:13:29 6051 [Note] InnoDB: Using atomics to ref count buffer pool pages
2019-01-14 23:13:29 6051 [Note] InnoDB: The InnoDB memory heap is disabled
2019-01-14 23:13:29 6051 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2019-01-14 23:13:29 6051 [Note] InnoDB: Memory barrier is not used
2019-01-14 23:13:29 6051 [Note] InnoDB: Compressed tables use zlib 1.2.11
2019-01-14 23:13:29 6051 [Note] InnoDB: Using Linux native AIO
2019-01-14 23:13:29 6051 [Note] InnoDB: Using CPU crc32 instructions
2019-01-14 23:13:29 6051 [Note] InnoDB: Initializing buffer pool, size = 128.0M
InnoDB: mmap(137363456 bytes) failed; errno 12
2019-01-14 23:13:29 6051 [ERROR] InnoDB: Cannot allocate memory for the buffer pool
2019-01-14 23:13:29 6051 [ERROR] Plugin 'InnoDB' init function returned error.
2019-01-14 23:13:29 6051 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2019-01-14 23:13:29 6051 [ERROR] Unknown/unsupported storage engine: InnoDB
2019-01-14 23:13:29 6051 [ERROR] Aborting

解决方案:(以下是网上答案)

  • dd if=/dev/zero of=/swap bs=1M count=512 # 创建一个swap文件,大小为512M
  • mkswap /swap # 将swap文件变为swap分区文件
  • swapon /swap # 将其映射为swap分区

  • vi /etc/fstab # 在其中添加如下一行
    /swap swap swap defaults 0 0

linux中nginx、mysql安装碰到的问题的更多相关文章

  1. linux中nginx的安装,linux的版本是ubutu

    linux环境下,安装nginx,报错如下: the HTTP rewrite module requires the PCRE library. 1.需要安装pcre,报一下错误: you need ...

  2. Linux中nginx手动安装

    本分类下有一个环境一键安装.那这背后发生了什么呢?咱们手动使用源码进行安装. 1.首先保证有一个能联网的centos. 2.百度 ningx 官网   点download  http://nginx. ...

  3. Linux中Nginx安装与配置详解

    转载自:http://www.linuxidc.com/Linux/2016-08/134110.htm Linux中Nginx安装与配置详解(CentOS-6.5:nginx-1.5.0). 1 N ...

  4. linux中Nginx安装

    linux中Nginx安装 编译安装 ​ Nginx的优点太多,这里不再赘述,详情请看这篇博客深入理解nginx. ​ Nginx的安装有rpm包安装.编译安装和docker安装.本文将介绍编译安装方 ...

  5. linux中mariadb的安装

    在Linux中mariaDB的安装 MariaDB其实就是MySQL的分支,是为了应对MySQL的即将的闭源风险所产生的. Linux系统中软件包的格式为mysql.rpm格式. 通过yum去安装 L ...

  6. 阿里云Linux服务器安装 nginx+mysql+php

    阿里云Linux服务器安装 nginx+mysql+php步骤1.登录服务器2.下载安装包3.将安装包上传到服务器的/home目录下 注:使用rz sz命令进行本地和服务器间的上传.下载,安装命令yu ...

  7. Linux下nginx编译安装教程和编译参数详解

    这篇文章主要介绍了Linux下nginx编译安装教程和编译参数详解,需要的朋友可以参考下 一.必要软件准备1.安装pcre 为了支持rewrite功能,我们需要安装pcre 复制代码代码如下: # y ...

  8. Linux(Manjaro) - Docker - MySQL 安装配置

    Linux(Manjaro) - Docker - MySQL 安装配置 拉取mysql镜像 # 使用网易的 MySQL 镜像地址 docker pull hub.c.163.com/library/ ...

  9. windows与linux中的mysql配置主从

    最近在给学生讲解数据库的主从配置,由于学生电脑里面装的虚拟机是linux的,但是本机的系统是windows的,所以需要用windows中的mysql与linux中的mysql进行主从配置.下面说一下主 ...

随机推荐

  1. python与mysql部分函数和控制流语法对比

    条件语句 python语法 a=int(input("输入一个数[0,100]成绩:")) if 100>=a>=90: print("优") el ...

  2. 线程池-进程池-io模型

    一.线程池与进程池 什么是池?简单的说就是一个容器,一个范围 在保证计算机硬件安全的情况下最大限度的充分利用计算机, 池其实是降低了程序的运行效率,但是保证了计算机硬件的安全,也是实现了一个并发的效果 ...

  3. js获取当前页面名称

    // 取当前页面名称(不带后缀名) function pageName() { var a = location.href; var b = a.split("/"); var c ...

  4. iTOP-iMX6UL开发板-动态调频技术文档分享

    本文档以 iMX6UL 为例,简单介绍 cpufreq 的 5 种模式. 在 imx6ul 的 menuconfig 中,进入 CPU Power Management ---> CPU Fre ...

  5. 搭建WordPress个人博客

    1. 准备LNMP环境 LNMP 是 Linux.Nginx.MySQL 和 PHP 的缩写,是 WordPress 博客系统依赖的基础运行环境.我们先来准备 LNMP 环境 安装Nginx 使用 y ...

  6. D. Array Splitting(后缀数组)

    You are given an array

  7. smooth curve|population|sample

    Distribution Shapes 由直方图到 smooth curve   1.this distribution of heights is bell shaped(or mound shap ...

  8. Fiddler发送get post测试 笔记

    0 环境 系统环境:win7 1 操作 1 post 类似 2 get

  9. Computing Essentials_第一章习题

  10. mysql idb文件过大

    分开 保存,每个数据库有自己的 innodb_file_per_table=1