美文网首页
nginx代理/的详细教学,代理路径“/”示例

nginx代理/的详细教学,代理路径“/”示例

作者: WJaven | 来源:发表于2023-02-08 19:30 被阅读0次

    nginx中斜杠(/)详解

    location、proxy_pass都不加斜杠

    location /v1 {
        proxy_pass http://127.0.0.1:8899;
    }
    #实际访问代理地址:http://127.0.0.1:8899/v1/pt/apply/page
    

    location加斜杠、proxy_pass不加斜杠

    location /v1/ {
        proxy_pass http://127.0.0.1:8899;
    }
    #实际访问代理地址:http://127.0.0.1:8899/v1/pt/apply/page
    

    location不加斜杠、proxy_pass加斜杠

    location /v1 {
        proxy_pass http://127.0.0.1:8899/;
    }
    #实际访问代理地址:http://127.0.0.1:8899//pt/apply/page
    #其实是把location的v1截断了
    

    location、proxy_pass都加斜杠

    location /v1/ {
        proxy_pass http://127.0.0.1:8899/;
    }
    #实际访问代理地址:http://127.0.0.1:8899/pt/apply/page
    #把location下面的v1截断了
    

    location不加斜杠,proxy_pass加"v1"

    location /v1 {
        proxy_pass http://127.0.0.1:8899/v1;
    }
    #实际访问代理地址:http://127.0.0.1:8899/v1/pt/apply/page
    

    location加斜杠,proxy_pass加"v1"

        proxy_pass http://127.0.0.1:8899/v1;
    }
    #实际访问代理地址:http://127.0.0.1:8899/v1pt/apply/page
    

    location不加斜杠,proxy_pass加"v1/"

    location /v1 {
        proxy_pass http://127.0.0.1:8899/v1/;
    }
    #实际访问代理地址:http://127.0.0.1:8899/v1/pt/apply/page
    

    location加斜杠,proxy_pass加"v1/"

    location /v1/ {
        proxy_pass http://127.0.0.1:8899/v1/;
    }
    #实际访问代理地址:http://127.0.0.1:8899/v1/pt/apply/page
    

    相关文章

      网友评论

          本文标题:nginx代理/的详细教学,代理路径“/”示例

          本文链接:https://www.haomeiwen.com/subject/bcoqkdtx.html