admin管理员组

文章数量:1487745

linux nginx命令 查找目录和重启

#查看nginx进程

代码语言:javascript代码运行次数:0运行复制
[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配置文件位置

代码语言:javascript代码运行次数:0运行复制
[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

#启动

代码语言:javascript代码运行次数:0运行复制
[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

#停止 从容停止

代码语言:javascript代码运行次数:0运行复制
[root@LinuxServer ~]# kill -QUIT 2072

#快速停止

代码语言:javascript代码运行次数:0运行复制
[root@LinuxServer ~]# kill -TERM 2132
或 [root@LinuxServer ~]# kill -INT 2132

#强制停止

代码语言:javascript代码运行次数:0运行复制
[root@LinuxServer ~]# pkill -9 nginx

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

代码语言:javascript代码运行次数:0运行复制
[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服务

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。 原始发表:2022-03-20,如有侵权请联系 cloudcommunity@tencent 删除服务进程linuxnginxroot

本文标签: linux nginx命令 查找目录和重启