Frage

uWSGI config

[uwsgi]
socket = /tmp/uwsgi.sock
chmod-socket = 666
processes = 1
master = true
vhost = true
no-site = true

Nginx config

server {
    listen       80;
    server_name  www.site1.com;

    location / {
        include uwsgi_params;
        uwsgi_pass unix:/tmp/uwsgi.sock;
        uwsgi_param UWSGI_PYHOME /var/virtualenvs/site1;
        uwsgi_param UWSGI_CHDIR /var/www/site1;
        uwsgi_param UWSGI_SCRIPT wsgi;
    }
}

server {
    listen       80;
    server_name  www.site2.com;

    location / {
        include uwsgi_params;
        uwsgi_pass unix:/tmp/uwsgi.sock;
        uwsgi_param UWSGI_PYHOME /var/virtualenvs/site2;
        uwsgi_param UWSGI_CHDIR /var/www/site2;
        uwsgi_param UWSGI_SCRIPT wsgi;
    }
}

Whatever site I hit first is the one it is stuck displaying, so if I goto site2 first I can't ever see site1. Any thoughts on why the uWSGI vhost setting seems not to be workin?

War es hilfreich?

Lösung

The problem ending up being that using an INI config file results in uWSGI running in single interpreter mode. The exact same config in XML allows everything to work correctly. The uWSGI developer this would NOT be the case in future versions.

Andere Tipps

Here http://wiki.nginx.org/HttpUwsgiModuleMultipleDynamicApplications you can find example, how to setup multiple uWSGI apps, throuth a single upstream.

If you want to use TCP connection or nginx is built witout uwsgi_pass support:

nginx config:

location / {
    proxy_pass http://127.0.0.1:8010/;
    proxy_redirect off;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}

uwsgi ini file:

[uwsgi]
# set the http port
http = :8010

How about use TCP socket instead?

[uwsgi]
socket = 127.0.0.1:3031
processes = 1
master = true
vhost = true
no-site = true

nginx config

server {
    listen       80;
    server_name  www.site1.com;

    location / {
        include uwsgi_params;
        uwsgi_pass 127.0.0.1:3031;
        uwsgi_param UWSGI_PYHOME /var/virtualenvs/site1;
        uwsgi_param UWSGI_CHDIR /var/www/site1;
        uwsgi_param UWSGI_SCRIPT wsgi;
    }
}

server {
    listen       80;
    server_name  www.site2.com;

    location / {
        include uwsgi_params;
        uwsgi_pass 127.0.0.1:3031;
        uwsgi_param UWSGI_PYHOME /var/virtualenvs/site2;
        uwsgi_param UWSGI_CHDIR /var/www/site2;
        uwsgi_param UWSGI_SCRIPT wsgi;
    }
}
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top