zoukankan      html  css  js  c++  java
  • linux中nginx、mysql安装碰到的问题

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

    安装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

  • 相关阅读:
    转:Windows Socket五种I/O模型
    C++线程池的实现(二)
    C++ 简单 Hash容器的实现
    C++ TrieTree(字典树)容器的实现
    转载:C++线程池的一个实现
    C++用数组实现的静态队列
    C++ 类成员函数作为参数
    C++位操作符总结
    C++简单单例模式
    C++控制程序只运行一个实例
  • 原文地址:https://www.cnblogs.com/lijianming180/p/12255871.html
Copyright © 2011-2022 走看看