下載WINDOWS版本 -- http://nginx.org/en/download.html 下載的是ZIP包,解壓到喜歡的目錄。html
修改\conf\nginx.conf中的監聽端口(listen),改爲喜歡的端口,好比8090nginx
進入剛纔的目錄,使用命令 start nginx 啓動nginx服務,訪問 http://localhost:8090 進行測試api
#啓動nginx服務 start nginx
#不保存退出 nginx -s stop #保存退出 nginx -s quit #重啓 nginx -s reload
#配置文件中,第一個server{...}節後,添加一個server節。 #示例訪問http://127.0.0.1:8088時,會跳轉到 http://localhost/test1 server{ listen 8088; server_name 127.0.0.1; location / { proxy_pass http://localhost/test1; } }
upstream shareapis { server 內網IP1:8011 weight=10; server 內網IP2:8011 weight=10; } server { listen 80; server_name 外網IP; location / { proxy_pass http:// shareapis; } }
location / { root html; index index.html index.htm; } location /dist/ { #root D:/Services/nginx/html; alias D:/Apps/element-starter/dist/; index index.html index.htm; }
發現這裏講的很細:http://jspang.com/post/nginx.htmlbash