linux环境下nginx相关命令

1、Linux环境下确定Nginx是以那个config文件启动的:

[root@localhost ~]# ps -ef | grep nginx
root 21196 1 0 23:40 ? 00:00:00 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf
nginx 21197 21196 0 23:40 ? 00:00:00 nginx: worker process
root 21199 20993 0 23:42 pts/0 00:00:00 grep --color=auto nginx

2、检查是否已经安装有nginx及对应目录:

[root@localhost ~]# find /|grep nginx.conf
/etc/nginx/conf.d
/etc/nginx/conf.d/example_ssl.conf
/etc/nginx/conf.d/default.conf
/etc/nginx/nginx.conf

3、还可以用以下两个命令,找安装的路径

[root@localhost ~]# netstat -tnlp|grep nginx
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 21196/nginx: master

然后看到一行记录,复制最后的一个数据(进程ID)
ps -aux |grep 进程ID
就可以看到nginx的启动方式了。

[root@localhost ~]# ps -aux |grep 21196
root 21196 0.0 0.0 48044 924 ? Ss 23:40 0:00 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf
root 21204 0.0 0.2 112648 2320 pts/0 S+ 23:45 0:00 grep --color=auto 21196

4、查看服务器上安装的nginx版本号:

-v 显示 nginx 的版本。
-V 显示 nginx 的版本,编译器版本和配置参数。

[root@localhost ~]# /usr/sbin/nginx -v
nginx version: nginx/1.8.0

猜你喜欢

转载自blog.csdn.net/weixin_44671176/article/details/107929216