反向代理:reverse proxy,是指用代理服務器來接受客戶端發來的請求,而後將請求轉發給內網中的上游服務器,上游服務器處理完以後,把結果經過nginx返回給客戶端。nginx
假如須要根據url或ip得不一樣,把請求代理到不一樣得服務器就能夠這樣配置nginx.conf。服務器
events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; server { listen 80; server_name 127.0.0.6; location / { proxy_pass http://localhost:7001; } } server { listen 80; server_name 127.0.0.7; location / { proxy_pass http://localhost:7002; } } }