Setup multiple django gunicorn instances with ngin

2019-09-15 17:07发布

问题:

Got one django site running with gunicorn & nginx need to setup another site also with the same. Nginx settings is straight forward, how to rework below to add another site /home/ubuntu/webapps/uganda_buzz/

relevant settings are /etc/init/gunicorn.conf

description "Gunicorn application server handling all projects"

start on runlevel [2345]
stop on runlevel [!2345]

respawn
setuid user
setgid www-data
chdir /home/ubuntu/webapps/kenyabuzz

exec /home/ubuntu/webapps/djangoenv/bin/gunicorn --workers 3 --bind unix:/home/ubuntu/webapps/kenyabuzz/kb.sock kb.wsgi:application

and /etc/systemd/system/gunicorn.service

[Unit]
Description=gunicorn daemon
After=network.target

[Service]
User=ubuntu
Group=nginx
WorkingDirectory=/home/ubuntu/webapps/kenyabuzz
ExecStart=/home/ubuntu/webapps/djangoenv/bin/gunicorn --workers 3 --bind unix:/home/ubuntu/webapps/kenyabuzz/kb.sock kb.wsgi:application

[Install]
WantedBy=multi-user.target

回答1:

Try How To Set Up Nginx Server Blocks (Virtual Hosts) on Ubuntu 14.04 LTS

or Configuring multiple domains and subdomains. DNS & Nginx issues abound!