安裝使用到的基本軟件nginx、supervisor、gunicornpython
vi /etc/supervisor/conf.d/django_project.confnginx
[program:django_project] command=gunicorn xxx.wsgi:application -b 127.0.0.1:8080 -w 8 user=user #當前用戶 directory=/home/user/django_project stdout_logfile=/tmp/var/logs/supervisor/%(program_name)s-stdout.log stderr_logfile=/tmp/var/logs/supervisor/%(program_name)s-stderr.log killasgroup=true stopasgroup=true autorstart=true autorestart=true # rq隊列的配置 [program:rqworker] command=python manage.py rqworker default low user=user directory=/home/django_project/platform stdout_logfile=/tmp/var/logs/supervisor/%(program_name)s-stdout.log stderr_logfile=/tmp/var/logs/supervisor/%(program_name)s-stderr.log killasgroup=true stopasgroup=true autorstart=true autorestart=true``` 再在nginx配置中的location,添加
proxy_pass http://127.0.0.1:8080;django
另外靜態文件的代理能夠添加下面的配置
location /static/ {app
alias /django_project/statics/;
}代理