打印/下载
uWSGI
Nginx

安装

# Web服务
dnf install python3-devel
pip3 install uwsgi

# 依赖包
ln -s /usr/bin/python3 /usr/bin/python
ln -s /usr/bin/pip3 /usr/bin/pip
./webmis.sh install

Bash 命令

# 帮助
./webmis.sh -h
# 启动
./webmis.sh start
# 重启
./webmis.sh restart
# 停止
./webmis.sh stop

开机启动

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

添加内容

cd /xxx/python/ && ./webmis.sh start

demo.python.conf

upstream demo_flask {
    server unix:///home/www/base/python/server/web.sock;
}
upstream demo_python_websocket {
    server 127.0.0.1:5001;
}

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 /wss {
        proxy_pass http://demo_python_websocket;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "Upgrade";
        proxy_set_header Connection "keep-alive";
        proxy_set_header X-Real-IP $remote_addr;
    }

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