zoukankan      html  css  js  c++  java
  • Linux下启动,停止,重启Nginx、Mysql、PHP------Nginx常用命令(启动/重启/停止/测试配置文件/重新加载配置文件)

    LINUX启动Nginx的命令:
    一、查询是否启动
    [root@jiang php-fpm.d]# ps -ef | grep nginx
    root     25225     1  0 19:26 ?        00:00:00 nginx: master process /app/nginx/sbin/nginx
    www      25229 25225  0 19:26 ?        00:00:00 nginx: worker process
    root     25247 19431  0 19:30 pts/0    00:00:00 grep nginx
    二、启动
    [root@jiang php-fpm.d]# /app/nginx/sbin/nginx
    [root@jiang php-fpm.d]# ps -ef | grep nginx  
    root     25192     1  0 19:22 ?        00:00:00 nginx: master process /app/nginx/sbin/nginx
    www      25193 25192  0 19:22 ?        00:00:00 nginx: worker process
    root     25195 19431  0 19:22 pts/0    00:00:00 grep nginx
    三、停止
    从容停止Nginx:
    kill -QUIT 主进程号
    [root@jiang php-fpm.d]# kill -QUIT 19513
    [root@jiang php-fpm.d]# ps -ef | grep nginx
    root     25190 19431  0 19:22 pts/0    00:00:00 grep nginx
    快速停止Nginx:
    kill -TERM 主进程号
    [root@jiang php-fpm.d]# kill -TERM 25192
    [root@jiang php-fpm.d]# ps -ef | grep nginx
    root     25203 19431  0 19:23 pts/0    00:00:00 grep nginx
    [root@jiang php-fpm.d]# 
    强制停止Nginx:
    kill -9 主进程号
    [root@jiang php-fpm.d]# kill -9 25205
    [root@jiang php-fpm.d]# ps -ef | grep nginx
    www      25206     1  0 19:24 ?        00:00:00 nginx: worker process
    root     25210 19431  0 19:24 pts/0    00:00:00 grep nginx
    四、重启
    [root@jiang php-fpm.d]# /app/nginx/sbin/nginx -s reload
    [root@jiang php-fpm.d]# 
    LINUX启动MYSQL的命令:
    一、启动
    [root@jiang host]# service mysqld start
    Starting MySQL..                                           [  OK  ]
    或者
    [root@jiang host]# /etc/init.d/mysqld start
    Starting MySQL..                                           [  OK  ]
    二、停止
    [root@jiang host]# service mysqld stop
    Shutting down MySQL..                                      [  OK  ]
    或者
    [root@jiang host]# /etc/init.d/mysqld stop
    Shutting down MySQL.                                       [  OK  ]
    三、重启
    [root@jiang host]# service mysqld restart
    Shutting down MySQL..                                      [  OK  ]
    Starting MySQL..                                           [  OK  ]
    或者
    [root@jiang host]# /etc/init.d/mysqld restart
    Shutting down MySQL..                                      [  OK  ]
    Starting MySQL..                                           [  OK  ]
    四、查看mysql是否启动
    [root@jiang host]# service mysqld status
    MySQL running (24110)                                      [  OK  ]
    
    [root@jiang host]# ps aux | grep mysqld
    LINUX启动PHP的命令:
    service php-fpm restart
    停止PHP:
    [root@jiang host]# pkill php-fpm
    查看9000端口:
    [root@jiang host]# netstat -lnt | grep 9000
    [root@jiang host]# 
    启动PHP:
    [root@jiang sbin]# /app/php7.2/sbin/php-fpm
    查看9000端口:
    [root@jiang sbin]# netstat -tunlp | grep 9000
    tcp        0      0 127.0.0.1:9000              0.0.0.0:*                   LISTEN

    Nginx常用命令(启动/重启/停止/测试配置文件/重新加载配置文件)

     

    Nginx 安装后只有一个程序文件,本身并不提供各种管理程序,它是使用参数和系统信号机制对 Nginx 进程本身进行控制的。 Nginx 的参数包括有如下几个:

    使用:

    /usr/local/nginx/sbin/nginx -参数
    • -c:使用指定的配置文件而不是conf目录下的nginx.conf 。
    • -t:测试配置文件是否正确,在运行时需要重新加载配置的时候,此命令非常重要,用来检测所修改的配置文件是否有语法错误。
    • -s:reload 重载
    • -s:stop 停止

    启动/重启/停止

    sudo /etc/init.d/nginx {start|restart|stop}

    上面的命令其实是基于服务的形式,还可以这样写:

    sudo service nginx {start|stop|restart|reload|force-reload|status|configtest|rotate|upgrade}

    当然还有基于信号的方式,这个访问效果更好:

    #假设Nginx安装在/usr/local/nginx
    sudo /usr/local/nginx/nginx -s {参数}
    stop - 快速关机
    quit - 优雅的关机
    reload - 重新加载配置文件
    reopen - 重新打开日志文件

    检查配置,同时也是输出配置文件所在位置

    /usr/local/nginx/nginx -t

    修改配置后重载

    /usr/local/nginx/nginx -s reload

    参考:

    https://www.cnblogs.com/yeshaoxiang/p/8659708.html

    https://www.cnblogs.com/ireenin/p/6097518.html(以上内容转自此篇文章)

  • 相关阅读:
    PointToPointNetDevice doesn't support TapBridgeHelper
    NS3系列—10———NS3 NodeContainer
    NS3系列—9———NS3 IP首部校验和
    NS3系列—8———NS3编译运行
    【习题 7-6 UVA
    【Good Bye 2017 C】 New Year and Curling
    【Good Bye 2017 B】 New Year and Buggy Bot
    【Good Bye 2017 A】New Year and Counting Cards
    【Educational Codeforces Round 35 D】Inversion Counting
    【Educational Codeforces Round 35 C】Two Cakes
  • 原文地址:https://www.cnblogs.com/T8888/p/12792852.html
Copyright © 2011-2022 走看看