csdreamdong
V2EX  ›  问与答

请教一个 nginx+uwsgi+django 的问题

  •  
  •   csdreamdong · Jul 5, 2016 · 1856 views
    This topic created in 3605 days ago, the information mentioned may be changed or developed.
    nginx 的配置:
    
    server {
        listen       80;
        server_name  www.hehehe.com;
    
        charset utf-8;
    
        location /test {
            include uwsgi_params;
            uwsgi_pass 127.0.0.1:3031;
        }
    
    }
    
    uwsgi 的配置
    
    [uwsgi]
    uid = uwsgi
    gid = uwsgi
    socket = 127.0.0.1:3031
    chdir = /data/workspace/mblog
    env = DJANGO_SETTINGS_MODULE=mblog.settings
    module = django.core.wsgi:get_wsgi_application()
    logto = /var/log/mblog/uwsgi.log
    enable-threads = true
    processes = 2
    threads = 2
    master = true
    
    
    djang url 的配置
    
    urlpatterns = [
        url(r'^index/', include('index.urls')),
        url(r'^admin/', admin.site.urls),
    ]
    
    
    访问 http://www.hehehe.com/test/index 会进入到 django 的流程里没有错。
    但就是提示, The current URL, test/index/, didn't match any of these.
    问题就应该出在了 django 的 url 匹配问题上。
    
    nginx 把 /test ,反向代理到了 uwsgi 里。。但 django 中 url 匹配的时候还是算上了 /test
    
    同样的方式。。 apache 的, wsgiscriptalias ,就不会有问题。。求助怎么破。
    
    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   971 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 20:01 · PVG 04:01 · LAX 13:01 · JFK 16:01
    ♥ Do have faith in what you're doing.