nginx
ps -ef|grep nginx 查询nginx进程
[root@vat-nginx /]# ps -ef|grep nginx
root 1899 1 0 14:50 ? 00:00:00 nginx: master process ./nginx
nobody 2322 1899 0 17:20 ? 00:00:00 nginx: worker process
root 2372 1703 0 17:41 pts/0 00:00:00 grep nginx
定位当前正在运行的Nginx的配置文件
1、查看 nginx 的PID,以常用的80端口为例(nginx默认端口):
[root@vat-nginx /]# netstat -anp | grep :80 tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 1899/nginx 或者 [root@vat-nginx /]# lsof -i:80 COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME nginx 1899 root 6u IPv4 34816 0t0 TCP *:http (LISTEN) nginx 2322 nobody 6u IPv4 34816 0t0 TCP *:http (LISTEN)
2、通过相应的进程ID(比如:1899)查询当前运行的nginx路径:
[root@vat-nginx /]# ll /proc/1899/exe lrwxrwxrwx 1 root root 0 Dec 17 15:37 /proc/1899/exe -> /opt/nginx/nginx
3、获取到nginx的执行路径后,使用-t参数即可获取该进程对应的配置文件路径,如
[root@vat-nginx /]# /opt/nginx/nginx -t nginx: the configuration file /opt/nginx/conf/nginx.conf syntax is ok nginx: configuration file /opt/nginx/conf/nginx.conf test is successful
查找nginx的服务配置文件(即安装路径) find / -name nginx.conf 或
[root@vat-nginx opt]# find / -name nginx /opt/nginx /opt/nginx/nginx
其中nginx文件是命令文件,找到命令文件后就可以重启服务了
[root@vat-nginx nginx]# ./nginx -c conf/nginx.conf nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use) nginx: [emerg] bind() to 0.0.0.0:19090 failed (98: Address already in use) nginx: [emerg] bind() to 0.0.0.0:9091 failed (98: Address already in use) nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Address already in use) nginx: [emerg] still could not bind()
标签:
nginx
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· C#/.NET/.NET Core优秀项目和框架2025年2月简报
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
· 【杭电多校比赛记录】2025“钉耙编程”中国大学生算法设计春季联赛(1)