通过nginx进程查看对应的端口号

5 min read

查看nginx进程pid:

命令:

ps -ef | grep nginx

结果:

root      9836     1  0 Jul11 ?        00:00:00 nginx: master process /usr/local/nginx/sbin/nginx
nobody    9841  9836  0 Jul11 ?        00:00:09 nginx: worker process    

通过nginx进程pid查看占用端口(进程pid为9836)

命令:

netstat -nap | grep 9836

结果:

tcp        0      0 0.0.0.0:8081                0.0.0.0:*                   LISTEN      9836/nginx          
tcp        0      0 0.0.0.0:81                  0.0.0.0:*                   LISTEN      9836/nginx          
tcp        0      0 0.0.0.0:8082                0.0.0.0:*                   LISTEN      9836/nginx          
tcp        0      0 0.0.0.0:8083                0.0.0.0:*                   LISTEN      9836/nginx