使用nginx设置多个django gunicorn实例

时间:2017-02-10 10:10:10

标签: python django nginx gunicorn

让一个django网站与gunicorn& nginx也需要设置另一个网站。 Nginx设置很简单,如何在下面重新添加以添加其他网站/home/ubuntu/webapps/uganda_buzz/

相关设置为/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

/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