7./etc/nginx/conf.d/default.conf 配置文件:
server {
listen 80;
server_name www.zipeiyi.corp;
location / { #代表在瀏覽器直接輸入www.zipeiyi.com
root /usr/share/nginx/html; #去找這個絕對路徑目錄下的index.html
index index.html index.htm;
}
location /app.html { #代表訪問www.zipeiyi.corp/app.html
root html; #去找這個路徑下的index.html
index index.html index.htm; #代表nginx安裝目錄下的html文件夾,比如說你nginx安裝在了/opt/nginx 下,那么html代表的目錄就為 /opt/nginx/html
但是如果你寫 root /html ,那就不是相對路徑了(nginx安裝目錄下),那就是/html了
}
error_page 500 502 503 504 /50x.html; #定義的返回錯誤狀態(tài)碼是500 502的,統(tǒng)一跳轉(zhuǎn)到50x.html這個頁面
location = /50x.html {
root /usr/share/nginx/html;
}
}