NGINX
NGINX Trac
3rd Party Modules
Security Advisories
CHANGES
OpenResty
ngx_lua
Tengine
在线学习资源
NGINX 开发从入门到精通
NGINX Modules
ngx_echo
hellorocky728
V2EX  ›  NGINX

nginx rewrite 配置问题

  •  
  •   hellorocky728 · Oct 21, 2016 · 3016 views
    This topic created in 3517 days ago, the information mentioned may be changed or developed.

    最近用 flask 写了一个接口,在配置 nginx 转发的时候遇到了点小问题,nginx 配置如下:

    server {
        listen 80;
        server_name xxx.xxx.xxx;
    
        location /upload_api {
            rewrite ^/upload_api/(.+)$ /$1 break;
            proxy_pass http://127.0.0.1:8082;
        }
        
    }
    

    flask 收到的请求路径确实

    127.0.0.1 - - [21/Oct/2016 16:31:36] "GET /upload_api HTTP/1.0" 404 -
    

    我怎么能让用户请求/upload_api的时候 flask 收到的请求路径为/呢?

    1 replies    2016-10-24 11:42:04 +08:00
    teemoer
        1
    teemoer  
       Oct 24, 2016
    顶楼 我也想知道
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1000 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 38ms · UTC 22:29 · PVG 06:29 · LAX 15:29 · JFK 18:29
    ♥ Do have faith in what you're doing.