nginx中server配置簡單示例

2021-08-19 21:09:45 字數 397 閱讀 8780

ubuntu14.04下的nginx配置(配置檔案nginx.conf):

server 

error_page 500 502 503 504 /50x.html;

location = /50x.html

}

1、上述配置中第乙個location中的root指定與nginx同目錄下的html目錄,index指定預設的歡迎頁面為index.html或index.htm。

2、error_page指定發生錯誤500 502 503 504後,轉向的頁面。50.html頁面同樣在html目錄下。

3、第二個location形式為location = /50x.html,表示精準的匹配。

4、與server同級的可以有多個。

nginx 中server配置說明

server error page 404 404.html 指定錯誤頁面 redirect server error pages to the static page 50x.html 把後台錯誤重定向到靜態的50x.html頁面 error page 500 502 503 504 50x.ht...

Nginx學習 安裝 命令 server配置

注意 以下內容是基於舊版nginx,配置資訊位置和檔案目錄和最新版不一致,但依葫蘆畫瓢是一樣的 nginx 的安裝 安裝準備 nginx依賴於pcre庫,要先安裝pcre yum install pcre pcre devel cd usr local src wget tar zxvfnginx ...

nginx中server的匹配順序

在開始處理乙個http請求時,nginx會取出header頭中的host,與nginx.conf中每個server的server name進行匹配,以此決定到底由哪乙個server塊來處理這個請求。server name與host匹配優先順序如下 1 完全匹配 2 萬用字元在前的,如 test.co...