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服务
分类:
运维
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 单元测试从入门到精通
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 上周热点回顾(3.3-3.9)
· winform 绘制太阳,地球,月球 运作规律