Skip to main content
您好,欢迎光临IDC汇,需要什么服务器直接咨询客服,方便快捷。客服QQ 点击这里给我发消息
首页 > 服务器技术 »正文

nginx+uswgi+supervisor

服务器技术 webadmin 2020-07-26 08:51:01 查看评论 加入收藏

nginx+uswgi+supervisor
supervisor:
添加一个supervisor.ini配置,然后在/etc/supervisord.conf文件中的include下files添加对应的路径
eg:
[include]
files = /home/coding/workspace/D_Test/D_Test/supervisor.ini

uwsgi.ini:
[uwsgi]
;与后面nginx配置路径要一样,启动时会生成对应的test.sock
socket = /var/tmp/test.sock
chdir = /home/coding/workspace/D_Test
wsgi-file = D_Test/wsgi.py
touch-reload = /home/coding/workspace/D_Test/reload
processes = 2
threads = 4
;对应上面的/var/tmp/test.sock权限
chmod-socket = 777
vacuum = true

supervisor.ini:
[program:test]
command=uwsgi --ini /home/coding/workspace/D_Test/D_Test/uwsgi.ini
directory=/home/coding/workspace/D_Test
startsecs=0

新建一个网站
/etc/nginx/sites-available/test_nginx.conf
server {
listen 8019;
server_name 0.0.0.0;
charset utf-8;
client_max_body_size 75M;

location / {
    #与上面uwsgi.ini中的socket一致
    uwsgi_pass  unix:///var/tmp/test.sock;
    include     /etc/nginx/uwsgi_params;
}

}
激活网站
sudo ln -s /etc/nginx/sites-available/test_nginx.conf /etc/nginx/sites-enabled/test_nginx.conf

最后:
启动supervisor在启动nginx
sudo supervisord -c /etc/supervisord.conf
sudo nginx

广告06

微信