首页 > 代码库 > centos 7编译安装nginx

centos 7编译安装nginx

  1. 禁用防火墙

    systemctl disable firewalld

    systemctl stop firewalld

    setenforce 0

  2. 安装pcre库 

    yum install pcre*

  3. 安装zlib库

    yum install zlib*

  4. 增加nginx用户:useradd nginx -G nginx

  5. 编译安装nginx:

    ./configure --prefix=/usr/local/nginx --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --user=nginx --group=nginx 

    make && make install

  6. 启动nginx:

    cd /usr/local/nginx/sbin

    nohup ./nginx &

centos 7编译安装nginx