安装:
1.去http://nginx.org下载
2.解压 tar -zxvf nginx-1.8.0.tar.gz
3.安装gcc yum -y install gcc gcc-c++ autoconf automake
4.安装pcre yum -y install pcre pcre-devel
5.安装zlib yum -y install zlib zlib-devel
6. ./configure
7.make
8.make install
启动:
/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
查找nginx的进程号:ps -ef|grep nginx
停止 nginx
1.从容停止 kill -QUIT [PID]
2.快速停止 kill -TERM [PID],kill -INT [PID]
3.强制停止 pkill -9 nginx
验证配置nginx配置文件
1.
cd /usr/local/nginx/sbin
./nginx -t
2.
/usr/local/nginx/sbin/nginx -t -c /usr/local/nginx/conf/nginx.conf
重启
1.
cd /usr/local/nginx/sbin
./nginx -s reload
2.
kill -HUP [PID]
Nginx的信号控制
HUP:重启
QUIT:从容关闭
TERM:快速关闭
INT:从容关闭
USR1:切换日志文件
USR2:平滑升级可执行进程
WINCH:从容关闭工作进程
Nginx 的平滑升级
cp -rfp objs/nginx /usr/local/nginx/sbin