Nginx常用命令:
啟動nginx服務
[root@localhost ~]# service nginx start [root@localhost ~]# systemctl start nginx.service [root@localhost ~]# /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf # nginx安裝目錄 -c nginx.conf組態檔目錄, [root@localhost sbin]# ./nginx # 進入/usr/local/nginx/sbin/ 即nginx的安裝目錄下,通過 ./nginx 啟動nginx服務, # 啟動nginx服務:引數 “-c” 指定了組態檔的路徑,如果不加 “-c” 引數,Nginx 會默認加載其安裝目錄的 conf 子目錄中的 nginx.conf 檔案,
停止nginx服務
[root@localhost ~]# service nginx stop [root@localhost ~]# systemctl stop nginx.service [root@localhost sbin]# ./nginx -s stop 進入 nginx 的安裝目錄,通過 ./nginx -s stop 停止nginx服務,先查出nginx行程id,再使用kill命令強制殺掉行程, [root@localhost sbin]# ./nginx -s quit 進入 nginx 的安裝目錄,通過 ./nginx -s quit 停止nginx服務,先等待nginx行程處理任務完畢后再停止,
重啟nginx服務
[root@localhost ~]# service nginx restart [root@localhost ~]# systemctl restart nginx.service [root@localhost sbin]# ./nginx -s quit # 對 nginx 進行先停止再啟動, [root@localhost sbin]# ./nginx
多載nginx組態檔
[root@localhost ~]# service nginx reload [root@localhost ~]# systemctl reload nginx.service [root@localhost sbin]# ./nginx -s reload 進入nginx的安裝目錄,通過 ./nginx -s reload 重新加載nginx組態檔, # 當 nginx的組態檔 nginx.conf 修改后,要想讓配置生效需要重啟 nginx,使用-s reload不用先停止再啟動 nginx,即可將配置資訊在 nginx 中生效,
其他nginx命令
# 查看nginx安裝目錄 [root@localhost ~]# ps -ef | grep nginx # 查看nginx.conf組態檔目錄,驗證nginx組態檔是否正確,進入nginx安裝目錄下,執行./nginx -t命令, [root@localhost sbin]# ./nginx -t
Nginx組態檔:
重定向問題
server {
listen 80;
listen 443 ssl;
server_name www.adspush.com adspush.com;
index index.php index.html index.htm default.php default.htm default.html;
root C:/wwwroot/www.adspush.com;
#REWRITE-START
include rewrite/www.adspush.com/*.conf;
#REWRITE-END
#redirect 重定向
# include redirect/www.fpaiseo.com/*.conf;
if ($host ~ '^fpaiseo.com'){
return 301 http://www.fpaiseo.com/$request_uri;
}
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/63524.html
標籤:其他
上一篇:Web服務器—IIS
下一篇:Web服務器—Apache
