windows-nginx 官網
http://nginx.org/en/docs/windows.html 點擊跳轉
安裝包下載
http://nginx.org/en/download.html 點擊跳轉
下載后解壓,解壓后如下

啟動nginx
- 直接雙擊nginx.exe,雙擊后一個黑色的彈窗一閃而過
- 打開cmd命令窗口,切換到nginx解壓目錄下,輸入命令 nginx.exe 或者 start nginx ,回車即可

檢查nginx是否啟動成功
- 直接在瀏覽器地址欄輸入網址
http://localhost:80,回車,出現以下頁面說明啟動成功

- 在cmd命令窗口輸入命令 tasklist /fi "imagename eq nginx.exe" ,出現如下結果說明啟動成功

關閉nginx
- 輸入nginx命令 nginx -s stop(快速停止nginx) 或 nginx -s quit(完整有序的停止nginx)
- 使用taskkill taskkill /f /t /im nginx.exe
nginx配置
nginx的配置文件是conf目錄下的nginx.conf,默認配置的nginx監聽的端口為80

運行靜態資源
將靜態資源(如jpg|png|css|js等)放在如下配置的F:\front\dist目錄下,然后在nginx配置文件中做如下配置(注意:靜態資源配置只能放在 location / 中),瀏覽器中訪問
http://192.168.1.105:9090/module/index.html即可訪問到 F:\front\dist 目錄下的頁面


配置文件 proxy.conf 放在conf目錄下
proxy_http_version 1.1;
proxy_connect_timeout 300s;
proxy_send_timeout 900;
proxy_read_timeout 7200s;
proxy_headers_hash_max_size 51200;
proxy_headers_hash_bucket_size 6400;
proxy_buffer_size 32k;
proxy_buffers 4 64k;
proxy_busy_buffers_size 128k;
proxy_redirect off;
proxy_hide_header Vary;
proxy_set_header Accept-Encoding '';
proxy_set_header Referer $http_referer;
proxy_set_header Cookie $http_cookie;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
