随笔 - 547  文章 - 1  评论 - 293  阅读 - 33万

linux nginx命令 查找目录和重启

#查看nginx进程

[root@LinuxServer]$ps -aux | grep nginx
root 3229 0.0 0.0 112812 972 pts/0 S+ 16:50 0:00 grep --color=auto nginx
root 15919 1.5 0.4 122856 68888 ? S Mar07 290:44 nginx: worker process
root 15920 0.7 0.4 123320 68932 ? S Mar07 134:04 nginx: worker process
root 15921 0.9 0.4 123320 68840 ? S Mar07 176:46 nginx: worker process
root 15922 2.9 0.4 125924 71920 ? S Mar07 548:55 nginx: worker process
root 20544 0.0 0.2 96184 37844 ? Ss 2021 0:01 nginx: master process nginx

 


#测试Nginx配置文件,可以看到nginx配置文件位置

[root@LinuxServer /]$nginx -t
nginx: the configuration file /usr/local/nginx//conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx//conf/nginx.conf test is successful

 

#启动

[root@LinuxServer sbin]# /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
[root@LinuxServer sbin]# /usr/local/nginx/sbin/nginx -t -c /usr/local/nginx/conf/nginx.conf

 

#停止
从容停止

[root@LinuxServer ~]# kill -QUIT 2072

 


#快速停止

[root@LinuxServer ~]# kill -TERM 2132
或 [root@LinuxServer ~]# kill -INT 2132

 


#强制停止

[root@LinuxServer ~]# pkill -9 nginx

 


#重启
#进入nginx可执行目录sbin下,输入命令./nginx -s reload

[root@LinuxServer sbin]$pwd
/usr/local/nginx/sbin
[root@LinuxServer sbin]$ll
total 9232
-rwxr-xr-x 1 root root 9451008 Dec 3 2018 nginx
nginx -s reload

 


#方法2 查找当前nginx进程号,然后输入命令:kill -HUP 进程号 实现重启nginx服务

posted on   oktokeep  阅读(1124)  评论(2编辑  收藏  举报
相关博文:
阅读排行:
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 单元测试从入门到精通
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 上周热点回顾(3.3-3.9)
· winform 绘制太阳,地球,月球 运作规律
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

点击右上角即可分享
微信分享提示