安装
⑴下载安装包gz包
官网地址:http://nginx.org/en/download.html
小编下载的版本号:1.14.0
⑵ 解压
tar -zxvf nginx-1.14.0.tar.gz
⑶ 编译安装
./configure --prefix=/usr/local/nginx
# 不写prefix默认为/usr/local/
make & make install
⑷ 启动
cd /usr/local/nginx/sbin
./nginx #启动
./nginx -t #检查配置文件格式是否正确
./nginx -s reload #重启nginx
常用命令
查看进程:
ps -ef|grep nginx
关闭nginx
从容停止 : Kill -QUIT 13421
快速停止 : kill -TERM 13421 或 kill -INT 13421
强制停止 : pkill -9 nginx
常见问题:
./configure: error: the HTTP rewrite module requires the PCRE library.
或者
./configure: error: the HTTP rewrite module requires the zlib library.
或者
./configure: error: the HTTP rewrite module requires the openssl library.
这些都是缺少依赖造成的,执行以下安装命令就可以:
yum install pcre-devel
yum install openssl-devel
yum install zlib-devel