nginx虛擬主機配置
server { listen 80; server_name localhost; location / { root html; index index.html index.htm; } error_page 404 /404.html; # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root html; }}
配置說明:
listen 80; =>指定虛擬主機監聽的是80端口
server_name localhost; =>指定虛擬主機域名
location / { ... } =>匹配請求路徑,/表示匹配所有請求
root html; =>指定虛擬主機的物理根目錄,eg、html物理根目錄位于D:/div/nginx-1.9.14/html/
index index.html index.htm; =>指定虛擬主機的默認首頁,默認首頁位于D:/div/nginx-1.9.14/html目錄下
感謝閱讀,希望能幫助到大家,謝謝大家對本站的支持!
新聞熱點
疑難解答