nginx的proxy_redirect樣例


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/

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM