django == 1.11.16
nginx == 1.10.3
项目编写
安装nginx
配置uwsgi
1 2 3 4 5 6 7
| [uwsgi] socket=:9000 chdir=/mnt/project/project_api module=pro.wsgi master=true processes=4 vacuum=true
|
配置nginx
- 打开/etc/nginx/nginx.conf文件http{}中添加一个server
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
| server { listen 80; server_name 域名 或者 localhost; charset UTF-8; access_log /var/log/nginx/djangohost.access.log; error_log /var/log/nginx/djangohost.error.log; location / { include uwsgi_params; uwsgi_pass 127.0.0.1:9000; uwsgi_read_timeout 2; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } }
|
1 2 3 4 5
| ps -ef | grep nginx kill -HUP < pid >
# 或者使用 service service nginx restart
|