uwsgi配置
[uwsgi]
#virtualenv=/usr/local/scripts/python34projectpiot
socket = 127.0.0.1:3031
chdir = /usr/local/scripts/python34projectpiot
wsgi-file = ./python34projectpiot/wsgi.py
processes = 4
threads = 2
stats = 127.0.0.1:9191
# 下面这个很重要,加上后就跑到后台运行了。但是supervisord要求程序不能在后台运行,所以注释掉就可以在supervisord里面进行调用了
#daemonize=/var/log/nginx/uwsgi.log
supervisord配置
[program:django]
priority=1
command=/usr/local/scripts/python34projectpiot/start.sh
directory=/usr/local/scripts/python34projectpiot
autostart=true
autorestart=true
startretries=100
#exitcodes=1
#stopsignal=KILL
stopsignal=TERM
stopasgroup=true ; 是否想UNIX进程组发送结束信号 (default false)
killasgroup=true ; SIGKILL UNIX 进
stderr_logfile=/data/logs/django.error.log
stdout_logfile=/data/logs/django.infolog
nginx配置
upstream django {
server 127.0.0.1:3031;
}
server {
listen 80;
charset utf-8;
server_name ims.ops.ac.cn;
access_log /var/log/nginx/ims.a.log;
error_log /var/log/nginx/ims.e.log;
location / {
include uwsgi_params;
#proxy_set_header Host $host;
#proxy_pass http://127.0.0.1:8081;
#uwsgi_pass 127.0.0.1:3031;
uwsgi_pass django;
# proxy_http_version 1.1; // 这两个最好也设置
proxy_set_header Connection "";
}
location /static {
root /usr/local/scripts/python3.4iiotdjango/lib/python3.4/site-packages/django/contrib/admin;
}
}
但是目前发现一个问题,就是supervisord虽然可以启动uwsgi,但是关闭后,uwsgi的进程还在。