nginx在windowns下路徑
http{
#虛擬主機1
server{
listen 80; #監聽端口,基於IP配置的時候變更此處,比如192.168.1.100:8080;
server_name www.xdw.com; #主機域名,實際項目發布的話,填公網上的域名,本地部署的話,可以在C:\Windows\System32\drivers\etc\hosts文件中添加IP和域名的映射
location / { #映射解析,/代表根路徑,此處解析還有正則表達式的解析方式,具體請參考http://tengine.taobao.org/nginx_docs/cn/docs/http/ngx_http_core_module.html#location
root E:/xdw/0221; #工程所在路徑
index index.html index.htm; #首頁(默認頁)
}
}
#虛擬主機2,可以同時配置多個虛擬主機
server{
listen 8080;
server_name localhost;
location / {
root D:/xiangmu/txym_web;
index index.html index.htm;
}
}
}
http下的一些配置及其意義
include mime.types; #文件擴展名與文件類型映射表
default_type application/octet-stream; #默認文件類型
sendfile on; #開啟高效文件傳輸模式,sendfile指令指定nginx是否調用sendfile函數來 輸出文件,對於普通應用設為 on,如果用來進行下載等應用磁盤IO重負載應用,可設置 為off,以平衡磁盤與網絡I/O處理速度,降低系統的負載。注意:如果圖片顯示不正常 把這個改成off。
autoindex on; #開啟目錄列表訪問,合適下載服務器,默認關閉。
tcp_nopush on; #防止網絡阻塞
tcp_nodelay on; #防止網絡阻塞
keepalive_timeout 120; #長連接超時時間,單位是秒
gzip on; #開啟gzip壓縮輸出