黑猴子的家:Nginx 命令

1、nginx启动命令

[[email protected] nginx]# cd /usr/local/nginx
[[email protected] nginx]# pwd
/usr/local/nginx

[[email protected] nginx]# ll
drwxr-xr-x. 2 root root 4096 11月 14 17:14 conf
drwxr-xr-x. 2 root root 4096 11月 14 17:14 html
drwxr-xr-x. 2 root root 4096 11月 14 17:14 logs
drwxr-xr-x. 2 root root 4096 11月 14 17:14 sbin

//-c 是 指定 配置文件,也可以直接把配置文件 复制过来
[[email protected] nginx]# sbin/nginx -c \
/opt/software/nginx/nginx-1.11.1/conf/nginx.conf
黑猴子的家:Nginx 命令

2、nginx无法启动

nginx无法启动: libpcre.so.1/libpcre.so.0: cannot open shared object file解决办法

(1)64位 解决方法

[[email protected] nginx]# ln -s /usr/local/lib/libpcre.so.1 /lib64

(2)32位 解决方法

[[email protected] nginx]# ln -s /usr/local/lib/libpcre.so.1 /lib

3、nginx关闭命令

[[email protected] ~]# cd /usr/local/nginx/
[[email protected] nginx]# sbin/nginx -s stop

4、nginx重新加载命令

修改配置后重新加载生效

[[email protected] ~]# cd /usr/local/nginx/
[[email protected] nginx]# sbin/nginx -s reload

5、设置nginx为自启动服务

[[email protected] ~]# vim /etc/rc.d/rc 
 /usr/local/nginx/sbin/nginx

6、平滑重启nginx

[[email protected] ~]# ps -ef | grep nginx
89673
[[email protected] ~]# kill -HUP 89673

7、完整有序的停止nginx

quit

8、重新打开日志文件

[[email protected] ~]# nginx -s reopen