【nginx】常用命令 启动|停止|重启|重新读取配置-centOS7

不羁的心 提交于 2020-04-25 13:25:58

 查看服务的当前状态

(flaskApi) [root@67 goTest]# systemctl status nginx.service
● nginx.service - The nginx HTTP and reverse proxy server
   Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled; vendor preset: disabled)
   Active: active (running) since 一 2019-10-21 13:52:34 CST; 3min 56s ago
 Main PID: 25799 (nginx)
   CGroup: /system.slice/nginx.service
           ├─25799 nginx: master process /usr/sbin/nginx
           ├─25800 nginx: worker process
           ├─25801 nginx: worker process
           ├─25802 nginx: worker process
           └─25803 nginx: worker process

10月 21 13:52:34 67.59.247.60.static.bjtelecom.net systemd[1]: Starting The nginx HTTP and r....
10月 21 13:52:34 67.59.247.60.static.bjtelecom.net nginx[25793]: nginx: the configuration fi...k
10月 21 13:52:34 67.59.247.60.static.bjtelecom.net nginx[25793]: nginx: configuration file /...l
10月 21 13:52:34 67.59.247.60.static.bjtelecom.net systemd[1]: Started The nginx HTTP and re....
Hint: Some lines were ellipsized, use -l to show in full.

启动nginx服务

systemctl start nginx.service

停止nginx服务

systemctl stop nginx.service 

 重新启动服务

systemctl restart nginx.service

重新读取nginx配置(这个最常用, 不用停止nginx服务就能使修改的配置生效)

systemctl reload nginx.service

 

参考文档:写的超全,又清楚又详细!

centos7安装Nginx配置自启动命令

 

另:最新版本的nginx启动后,通过浏览器访问,不再是熟悉的welcome to nginx页面,而是下面这样子了

 

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!