查看服務的當前狀態
(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頁面,而是下面這樣子了