简体   繁体   中英

Run 2 uWSGI on the same server with Nginx

Is it possible to run two separate uWSGI process on the same server with Nginx serving up both sets of static files?

So far, this setup appears to work sometimes, but requests are failing sometimes....

nginx.conf :

http {
    upstream deploy {
        server 127.0.0.1:8002;
    }

    server {
        # nginx config - deploy
    }

    upstream staging {
        server 127.0.0.1:8001;
    }

    server {
        # nginx config - staging
    }
}

I do have on both uWSGI.ini files master=True . Here's what they both look like:

uwsgi.ini

[uwsgi]

home = /home/bsdev/.virtualenvs/bs_py34/
env = DJANGO_SETTINGS_MODULE=myproject.settings.persistent

socket = 127.0.0.1:8003
chmod-socket = 666
uid = bsdev
gid = bsdev
master = true
enable-threads = true
processes = 4

chdir = /www/django/releases/persistent/bsrs/bsrs-django/myproject
module = myproject.wsgi:application
pidfile = /tmp/myproject-master-persistent.pid
harakiri = 10
max-requests = 5000
logdate = true
vacuum = true

daemonize = /var/log/uwsgi/myproject-persistent.log
logdate = true

Any ideas on how to get this to work?

Does anyone have a working configuration?

It seems like having them both as master, or if the same uwsgi process is serving both, that requests are getting dropped....

Thanks in advance.

Stack:

  • Nginx
  • uwsgi
  • Django 1.8

To hold two and more separate projects, l'd recommend the following:

  1. Install separate uWSGI for each project in its virtualenv
  2. Create separate virtual servers in nginx/sites-available for each project, pointing at its own uWSGI

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM