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

安装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——课程数据统计分析

    介绍 在该章节中我们将利用提供的课程数据来进行一次实战性质的时间序列和聚类分析. 知识点 数据处理 数据可视化 中文分词 文本聚类 数据概览 本次课程的数据来源于运行过程中产生的真实数据,我们对部分数 ...

  2. echart图表demo

    <!DOCTYPE html><html><head> <title>echarts</title></head><scr ...

  3. Linux c 操作MySQL

    #include <mysql/mysql.h>#include <stdio.h>#include <stdlib.h>int main() { MYSQL *c ...

  4. 从git上拉取项目 如果数据库密码不一致 会报错 500

    解决方法 在该路径下设置 数据库的密码

  5. soap,restful 两种web service实现方式比较

    web service服务 目前常用的实现web service的方式有有两种 1.SOAP 原始的web service标准,一堆标准,不过这些标准是在开发框架中实现的,有上层接口,可以调用 2.R ...

  6. python学习——tuple

    tuple 上次谈到了列表,而这次所谈的元组其实和列表有许多相似的地方,故元组又叫"戴上了枷锁的列表".这是因为元组不能改动内部的元素,所以就不能使用上次谈到的append.ext ...

  7. UI自动化(selenium+python)之浏览器驱动chromedriver安装和配置

    一.安装selenium 前提是已安装Python,python安装 自行百度,这里不概述 安装好python后,cmd打开终端窗口-->pip命令安装 :pip install seleniu ...

  8. 感叹号在Linux bash中使用技巧

    1. 重复执行上一条指令  !! [root@iZ23t6nzr7dZ python]# ls /usr/local/ aegis bin etc games include lib lib64 li ...

  9. Mock相关知识和简单应用

    一.moco的简单应用 moco地址:https://github.com/dreamhead/moco api文档地址: https://github.com/dreamhead/moco/blob ...

  10. BigDecimal进行精确运算

    public class Test_1 { public static void main(String[] args) { System.out.println(0.06+0.01); System ...