vue flask uwsgi nginx 配置

Mac下:

nginx

  • 配置文件地址/usr/local/etc/nginx/nginx.conf
  • 服务器默认路径/usr/local/var/www
  • 服务器相关操作
1. 启动命令: sudo nginx
2. 重启命令: sudo nginx -s reload
3. 停止命令: sudo nginx -s stop
  • 配置 nginx.conf,在http块下加入
server {
    # 监听端口
    listen 80;
    # 监听ip 换成服务器公网IP
    server_name 127.0.0.1;
 
    #动态请求
    location / {
      include uwsgi_params;
      uwsgi_pass 127.0.0.1:8000;#此端口号对应下面的uswgi内的socket
    }
    #静态请求
    location /static {
        alias /Users/xiaoyuan/Desktop/flask_test/static;

    }
}

uwsgi

  • 安装 pip install uwsgi
  • 在项目目录创建一个uwsgi.ini的配置文件
[uwsgi]

chdir=/Users/xxx/sites/qcs_flask/backend
home=/Users/xxx/sites/qcs_flask/backend/venv
module=run
callable=app
master=true
processes=4
threads=2

chmod-socket=666
logfile-chmod=644
uid=qcs_flask
gid=qcs_flask
procname-prefix-spaced=qcs_flask
py-autoreload=1
socket = 0.0.0.0:8050
vacuum=true
socket=%(chdir)/uwsgi/uwsgi.sock
stats=%(chdir)/uwsgi/uwsgi.status
pidfile=%(chdir)/uwsgi/uwsgi.pid
daemonize=%(chdir)/uwsgi/uwsgi.log
#详细内容查阅文档
  • 启动 uwsgi --ini uwsgi.ini
  • 停止uwsgi --stop uwsgi.pid
  • 杀死进程 kill pid

你可能感兴趣的:(vue flask uwsgi nginx 配置)