nginx.conf 配置
http { upstream myupstream{ server 192.168.1.124:11111 weight=10; server 192.168.1.125:11111 weight=10; } include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; server { listen 80; server_name virtualboxlinux2; access_log logs/virtualboxlinux2/host.access.log; root html; location /kingtool { proxy_pass http://myupstream; proxy_redirect off; } error_page 404 /404.html; error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } } }
訪問http://virtualboxlinux2/kingtool效果
最終被重定向到了http://myupstream/kingtool/