参考链接:
https://www.cnblogs.com/leiziv5/p/7137277.html
https://blog.csdn.net/szl13722587073/article/details/83106026
https://blog.csdn.net/qq_38677814/article/details/79491815
彻底卸载nginx:https://blog.csdn.net/sinat_34344123/article/details/79105254
GCC版本切换:https://blog.csdn.net/orange596/article/details/78244191
1、配置nginx.conf
server {
listen 80;
server_name 47.107.113.84 www.imagezxw.cn;
charset utf-8;
client_max_body_size 75M;
location / {
include uwsgi_params;
uwsgi_pass 127.0.0.1:3389;
uwsgi_param UWSGI_PYTHON /root/anaconda3/envs/tensorflow/bin/python;
uwsgi_param UWSGI_CHDIR /root/FlaskWebTest;
uwsgi_param UWSGI_SCRIPT wsgi:application;
}
}
首先删除掉Nginx的默认配置文件:
sudo rm /etc/nginx/sites-enabled/default
建立的配置文件使用符号链接到Nginx配置文件文件夹中,重启Nginx
sudo ln -s /root/FlaskWebTest/nginx.conf /etc/nginx/conf.d/
sudo /etc/init.d/nginx restart
2、配置uwsgi.ini
[uwsgi]
base = /root/FlaskWebTest
pidfile = /var/run/uwsgi.pid
master = true
wsgi-file = wsgi.py
chdir = /root/FlaskWebTest
socket = 127.0.0.1:3389
callable = application
logto = %n.log
processes = 10
master = true
workers=10
enable-threads = true
python -autoreload = 1
python -autoreload = 1表示每次修改python后都会重启uwsgi
执行uWSGI,用新创建的配置文件作为参数
uwsgi --ini /root/FlaskWebTest/uwsgi.ini
3、配置wsgi.py
import sys
# app's path
sys.path.insert(0,"/root/FlaskWebTest")
from manager import app
# Initialize WSGI app object
application = app
将这些配置都放在根目录