• 1. 查看NGINX是否在运行. 四种方式 nginx的配置文件的路径: /etc/nginx/nginx.conf


    1. 查看NGINX是否在运行.

    1. 查看NGINX是否在运行.

    ps aux | grep nginx
    [root@bogon /]# ps aux | grep nginx
    root      2318  0.0  0.0  56816  1272 ?        Ss   5月04   0:00 nginx: master process /usr/sbin/nginx
    nginx     2319  0.0  0.0  57264  2232 ?        S    5月04   0:00 nginx: worker process
    nginx     2320  0.0  0.0  57264  2232 ?        S    5月04   0:00 nginx: worker process
    nginx     2321  0.0  0.0  57264  1992 ?        S    5月04   0:00 nginx: worker process
    nginx     2322  0.0  0.0  57264  1992 ?        S    5月04   0:00 nginx: worker process
    nginx     2323  0.0  0.0  57264  2228 ?        S    5月04   0:00 nginx: worker process
    nginx     2324  0.0  0.0  57264  2232 ?        S    5月04   0:00 nginx: worker process
    nginx     2325  0.0  0.0  57264  2228 ?        S    5月04   0:00 nginx: worker process
    nginx     2326  0.0  0.0  57264  1992 ?        S    5月04   0:00 nginx: worker process
    root     21470  0.0  0.0 112732   968 pts/0    S+   09:56   0:00 grep --color=auto nginx
    

    第一种方法:查看进程列表并过滤

    Linux每个应用运行都会产生一个进程,那么我们就可以通过查看Nginx进程是否存在来判断它是否启动。

    用ps -ef列出进程列表,然后通过grep过滤。

    如: ps -ef | grep nginx 就可以看到度Nginx进程是否存在了

         ps -ef   | grep httpd

       netstat -tlnp | grep 端口号(默认是80) 

       lsof -i :端口号

    第二种方法:直接查看进程id

    ps -C nginx -o pid

    这种直接返回pid的方式比较适合跟其他程序结合使用,比如在shell/python脚本中执行这个命令拿到pid,让后回根据pid来判断Nginx是否启动。 

    通过端口判断

    第三种方法:使用netstat命令

    如果我们的Nginx运行在80端口,那么就可以通过netstat -anp | grep :80命令来判断Nginx是否启动。

    第四种方法:使用lsof命令

    lsof -i:80 也可以查到80端口进程是否有进程在答运行。

    ps -A | grep nginx 也可以

    2. 查看NGINX配置是否正确

    [root@bogon /]# nginx -t 
    nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
    nginx: configuration file /etc/nginx/nginx.conf test is successful

    nginx的配置文件的路径: /etc/nginx/nginx.conf

    http://t.zoukankan.com/niewd-p-12848844.html
  • 相关阅读:
    React获取文本框的值
    Ant-design正则判断_未输入用户名和密码点击按钮提示输入
    Redux的简单使用
    React后台管理系统 路由守卫
    移动端如何定义字体font-family
    meta基础知识
    闭包
    前端优化
    jacaScript数组
    分享一款强大的图片查看器插件,手机PC 通吃,功能超级齐全!
  • 原文地址:https://www.cnblogs.com/sunny3158/p/16778060.html
Copyright © 2020-2023  润新知