秦悦明的运维笔记

nginx+uwsgi部署django应用

0.安装uwsgi

1
pip install uwsgi

1.配置uwsgi

这里写到ini文件里面去。

1
2
3
4
5
6
7
8
9
[uwsgi]
chdir=/opt/zm_cmdb/zm_cmdb
module=zm_cmdb.wsgi:application
master=True
pidfile=/tmp/project-master.pid
vacuum=True
max-requests=5000
daemonize=/tmp/zm_cmdb.log
socket=/tmp/uwsgi.sock

2.nginx配置

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
server {
listen 80;
server_name localhost;
access_log /var/log/aca/access_log;
access_log /var/log/aca/error_log;
location /static/ {
alias /opt/zm_cmdb/zm_cmdb/static/;
}
location / {
uwsgi_pass unix:/tmp/uwsgi.sock;
include uwsgi_params;
}
}