我有两个django projects
在相同的ec2 instance
上运行在不同的端口上,我通过在gunicorn.service
创建/etc/systemd/system/
文件来配置gunicorn系统,如果我运行命令systemctl start gunicorn
,它工作得很棒。现在我想运行另一个proect,我该如何配置它,目前我正在运行使用gunicorn命令/usr/local/bin/gunicorn --graceful-timeout 30 --bind 0.0.0.0:8690 projectFile.wsgi:application --daemon
,我可以在gunicorn.service
本身添加相同的。如何在gunicorn systemd
中配置多个项目?
gunicorn.service文件 -
[Unit]
Description=gunicorn daemon
After=network.target
[Service]
PIDFile=/tmp/gunicorn.pid
LogFile=/tmp/lgunicorn.log
User=root
Group=www-data
WorkingDirectory=/home/ubuntu/website/UniservedWebsite
ExecStart = /usr/local/bin/gunicorn --workers 2 --graceful-timeout 30 --bind 0.0.0.0:8134 UniservedWebsite.wsgi:application
[Install]
WantedBy=multi-user.target
只需创建两个.service
文件,然后单独启动它们......