Django + nginx + uwsgi如何使用一个域来构建多个应用程序?

时间:2017-10-06 03:09:30

标签: django nginx subdomain uwsgi

我的问题是我如何使用一个域(mydomain.com)来构建多个django服务器?

这是我的nginx.conf,

upstream django_myproject {
    server unix:///home/frank/myproject/haunyu.sock; # for a file socket
}

server {
    listen      80;
    server_name mydomain.com; # This is my ow
    charset     utf-8;
    client_max_body_size 75M;   # adjust to taste
    # Django media
    location /media  {
        alias /home/frank/myproject/media;  
    }
    location /static {
    alias /home/frank/myproject/static;
}
location / {
    uwsgi_pass  django_myproject;
    include     /home/frank/myproject/uwsgi_params; # 
    uwsgi_read_timeout 600;
    }
}

我试着让位置" /"替换到位置" / first_app" 像这样

location /frist_app {
    uwsgi_pass  django_myproject;
    include     /home/frank/myproject/uwsgi_params; # 
    uwsgi_read_timeout 600;
    }
}

然后我尝试输入domain / frist_app到浏览器,我得到404,我的uwsgi也没有联系信息。

0 个答案:

没有答案