nginx 如何 反向代理相对的url?
大家讲道理
大家讲道理 2017-05-16 17:15:51
0
1
470
server {
    listen       80;
    server_name  www.hehehe.com;

    charset utf-8;
    
    location /test {
        include uwsgi_params;
        uwsgi_pass 127.0.0.1:3031;
    }
}

对于 http://hehehe.com/test/index 类似这样的请求
反向代理到了 uwsgi 是个django应用

然后我只想要把 /index 这部分的url反响代理过去,,而不是/test/index

现在/test/index 导致我的django的url路由匹配不上。

大家讲道理
大家讲道理

光阴似箭催人老,日月如移越少年。

全部回复(1)
Ty80
server {
    listen 80 default_server;
    client_max_body_size   10M;
    client_body_buffer_size   128k;

    server_name $host;

    index index.html;
    root /website/$host;
    location / {
    }
    location ~ /dev/ {
        rewrite /dev/(.*)$ / break;
        proxy_pass http://localhost:3000;
    }
}

rewrite一下

热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责声明 Sitemap
PHP中文网:公益在线PHP培训,帮助PHP学习者快速成长!