首先我的项目是CentOS7+Nginx+uWSGI+Flask部署
在运行python3 hello.py 测试的时候出现Nginx An error occurred
我的uwsgi.ini文件内容是
[uwsgi]
socket = 127.0.0.1:9000 #监听socket端口,uwsgi启动使用的地址和端口
master = true
module = run #python调用的模块
chdir = /www
wsgi-file = /www/hello.py #python启动程序文件
callable = app #程序中启动的app变量名
processes = 4 #uwsgi进程数
threads = 2 #uwsgi线程数
pythonpath = /www #项目目录
stats = %(chdir)/uwsgi/uwsgi.status
pidfile= %(chdir)/uwsgi/uwsgi.pid
daemonize = /var/log/uwsgi.log #日志路径
我的nginx的配置文件内容是
server {
listen 80;
server_name 139.105.102.000; #公网ip,站点url
index index.php index.html index.htm;#设置站点默认文档
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
include uwsgi_params; # 导入uwsgi配置
uwsgi_pass 127.0.0.1:9000;# 转发端口,需要和uwsgi配置当中的监听端口一致
uwsgi_param UWSGI_CHDIR /www; # 项目根目录
#uwsgi_param UWSGI_SCRIPT www.wsgi; #入口文件,即wsgi.py相对于项目根目录的位置,“.”相当于一层目录
}
我的项目放在www文件夹
uwsgi.ini,测试文件py也都放在www文件夹
由于自己是小白,摸索了好几天,希望大神看一下