> ### Centos7编译安装Nginx ``` [root@localhost /]# yum install epel-release //扩展包更新包 [root@localhost /]# yum update //更新yum源 [root@localhost /]# yum install -y wget vim [root@localhost /]# yum install -y gcc pcre pcre-devel zlib zlib-deve [root@localhost /]# cd /usr/local/ [root@localhost local]# wget http://nginx.org/download/nginx-1.12.2.tar.gz [root@localhost local]# tar -zxvf nginx-1.12.2.tar.gz [root@localhost local]# cd nginx-1.12.2 [root@localhost nginx-1.12.2]# ./configure \ --prefix=/usr/local/nginx \ --with-http_stub_status_module \ --with-pcre \ --without-http_gzip_module [root@localhost nginx-1.12.2]# make [root@localhost nginx-1.12.2]# make install [root@localhost nginx-1.12.2]# ln -s /usr/local/nginx/sbin/nginx /usr/bin/ [root@localhost /]# firewall-cmd --permanent --add-port=80/tcp [root@localhost /]# firewall-cmd --reload ``` > ### 测试 ``` [root@localhost /]# nginx 启动 [root@localhost /]# nginx -s reload 重新加载配置文件 [root@localhost /]# nginx -s reopen 重启 [root@localhost /]# nginx -s stop 停止 [root@localhost /]# nginx -s quit 处理完所有请求后再停止 [root@localhost local]# nginx ``` ![img](https://www.kancloud.cn/book/xiaohuamao/source-open-a/preview/images/219.png)