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