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

安装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. sqlalchemy 入门

    ORM技术:Object-Relational Mapping,把关系数据库的表结构映射到对象上. 在Python中,最有名的ORM框架是SQLAlchemy. # 导入: from sqlalche ...

  2. 安装 texlive

    多系统使用texlive 中文latex 用xelatex 编译 只需要加入宏包 \usepackage[UTF8]{ctex} Rmarkdown 配置模版 $ cat _output.yaml b ...

  3. 35)类和结构体类比---this

    那么,为啥  Test a(10)  , Test  b(20)   然后  我a.getI()  取到的是10,而不是20     就能将那个  10  给  a  对象的  m1    是因为有 ...

  4. android中的适配器模式

    原文: https://blog.csdn.net/beyond0525/article/details/22814129 类适配模式.对象适配模式.接口适配模式

  5. GPIO外部中断

    来源:莆田SEO 在STM32中,其每一个外设都可以产生中断. 中断分为分为 ①系统异常,内核 ②外部中断,外设 NVIC(Nested Vector Interrupt Controller ):嵌 ...

  6. php利用curl发送 post get del put patch 请求

    因为需要在php开发中对接其它接口需要用php  curl去对接其它接口  我把他们封装成函数 希望能对大家有所帮助 这里面是封装好的  会自动把data进行转成json格式   同时解码成php数组 ...

  7. Linux基础篇五:文件操作篇(三剑客)

    cut截取字段: -d  指定分割符 -f   指定第几列 例题1: echo "i am dusonglin ,my qq is  380343680 " >dusongl ...

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

    You are given an array

  9. Java操作redis客户端Jedis使用

    1.1   jedis介绍 Redis不仅是使用命令来操作,现在基本上主流的语言都有客户端支持,比如java.C.C#.C++.php.Node.js.Go等. 在官方网站里列一些Java的客户端,有 ...

  10. F5 BIG-IPLTM串联组网连接模式