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

安装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. LeetCode——735.行星碰撞

    给定一个整数数组 asteroids,表示在同一行的行星. 对于数组中的每一个元素,其绝对值表示行星的大小,正负表示行星的移动方向(正表示向右移动,负表示向左移动).每一颗行星以相同的速度移动. 找出 ...

  2. 第04项目:淘淘商城(SpringMVC+Spring+Mybatis)【第十天】(单点登录系统实现)

    https://pan.baidu.com/s/1bptYGAb#list/path=%2F&parentPath=%2Fsharelink389619878-229862621083040 ...

  3. java.lang.IllegalArgumentException: Cannot format given Object as a Date

    在进行日期转换的时候遇到了这个问题, 非常的恼火 SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss" ...

  4. Canal —— 基本概念及使用

    参考文档 开源数据同步神器--canal [若泽大数据]大数据之实时数据源同步中间件--生产上Canal与Maxwell颠峰对决

  5. shell_切割日志

    可以修改的:1.日志存放目录:logdir='/data/logs/'2.每个类型日志保留个数:savefiles=30 #!/bin/bashnum=$(date -d"+1 day ag ...

  6. iOS 清理文件缓存

    本文摘自:<msp的昌伟哥哥-iOS开发-清理缓存功能的实现>摘下来的目的就是为了能够学习.还望看到文章的同学,前往原创的博客园.感谢msp的昌伟哥哥的分享精神. 移动应用在处理网络资源时 ...

  7. [LC] 270. Closest Binary Search Tree Value

    Given a non-empty binary search tree and a target value, find the value in the BST that is closest t ...

  8. YII框架开发一个项目的通用目录结构:

    testdrive/    index.    assets/    css/    images/    themes/           yiic.       commands/        ...

  9. Ubuntu16.04编译libjpeg-turbo库

    一.环境依赖 CMake v2.8.12或以后 NASM or YASM (if building x86 or x86-64 SIMD extensions),如果使用NASM, 依赖2.10之后版 ...

  10. Java IO: 序列化与ObjectInputStream、ObjectOutputStream

    作者:Jakob Jenkov  译者: 李璟(jlee381344197@gmail.com) 本小节会简要概括Java IO中的序列化以及涉及到的流,主要包括ObjectInputStream和O ...