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

安装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画图例子代码

    matplotlib包,使得python可以使用类似matlab的命令 双坐标,子图例子 fig, axes = plt.subplots( 2,1, figsize=(14, 14) ) ax = ...

  2. 17.3.20---python的变量作用域

    1---变量的作用域 在Python程序中创建.改变.查找变量名时,都是在一个保存变量名的空间中进行,我们称之为命名空间,也被称之为作用域.Python的作用域是静态的,在源代码中变量名被赋值的位置决 ...

  3. FHQ treap板子

    感觉这个玩意就是拆来拆去,所以没啥可学习的 粘一下两个题的代码吧 LGOJ 普通平衡树 #include <bits/stdc++.h> using namespace std; #def ...

  4. Opencv笔记(二):图像的基本操作——续写

    1.图像的透视变换 对于视角变换,我们需要一个 3x3 变换矩阵.在变换前后直线还是直线.要构建这个变换矩阵,你需要在输入图像上找 4 个点,以及他们在输出图像上对应的位置.这四个点中的任意三个都不能 ...

  5. [单调队列]XKC's basketball team

    XKC's basketball team 题意:给定一个序列,从每一个数后面比它大至少 \(m\) 的数中求出与它之间最大的距离.如果没有则为 \(-1\). 题解:从后向前维护一个递增的队列,从后 ...

  6. 吴裕雄--天生自然python学习笔记:python安装配置tesseract-ocr-setup-3.05.00dev.exe

    下载地址:https://digi.bib.uni-mannheim.de/tesseract/tesseract-ocr-setup-3.05.00dev.exe 点击安装,记得复制安装的路径,待会 ...

  7. Seikimatsu Occult Tonneru(网络流,状态数(建不建边)不多时,可考虑直接进行枚举

    http://acm.hdu.edu.cn/showproblem.php?pid=4309 总结:边可存东西时,可新建一个点x连接u.v,x再连向汇点: #include<iostream&g ...

  8. java中BigDecimal的四舍五入小记

    static class test{ public static void main(String[] args) { BigDecimal b=new BigDecimal(45); BigDeci ...

  9. Error、Bias、Variance及损失函数理解

    个人感觉理解误差.偏置.方差的一个好的解释,感谢分享:https://baijiahao.baidu.com/s?id=1601092478839269810&wfr=spider&f ...

  10. 区别 new function(){} 和 function(){}()

    只要 new 表达式之后的 constructor 返回(return)一个引用对象(数组,对象,函数等),都将覆盖new创建的匿名对象,如果返回(return)一个原始类型(无 return 时其实 ...