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目錄下
感謝閱讀,希望能幫助到大家,謝謝大家對本站的支持!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。