打印/下载
uWSGI
Nginx

安装

pip3 install uwsgi

配置( python/server/app/server.ini )

[uwsgi]
chdir = ./
wsgi-file = %(chdir)web.py
socket = %(chdir)server/web.sock
logto = %(chdir)server/web.log
pidfile = %(chdir)server/web.pid
callable = app
processes = 4
chmod-socket = 666
py-autoreload = 1

运行

# 启动
uwsgi --ini web.ini &

#查看
ps -aux| grep uwsgi

# 重载
uwsgi --reload web.pid

开机启动

# 权限
chmod +x /etc/rc.d/rc.local
# 编辑文件
vi /etc/rc.d/rc.local

添加内容

cd /xxx/python/ && uwsgi --ini web.ini &

demo.python.conf

upstream demo_flask {
    server unix:///xxx/python/server/web.sock;
}

server {
    listen       80;
    server_name  demo-python.webmis.vip;
    set $root_path /xxx/python/;
    root $root_path;
    index index.html;

    charset utf-8;

    location / {
        uwsgi_pass  demo_flask;
        uwsgi_send_timeout 60;
        uwsgi_connect_timeout 60;
        uwsgi_read_timeout 60;
        include /etc/nginx/uwsgi_params;
    }

    location ~* ^/(webmis|upload|themes|favicon.png)/(.+)$ {
        root $root_path;
    }

    location ~ /\.ht {
        deny  all;
    }
}
  • 项目下创建upload目录,linux更改权限为777
{{copy}}