1、基于上文安装nginx
2、git下载flask应用程序,并进入虚拟环境,gunicorn运行
3、配置nginx.conf文件
location / {
proxy_pass http://127.0.0.1:8080; # 这里是指向 gunicorn host 的服务地址
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
问题:此时访问页面,会提示502错误,但本机测试curl一切正常,经分析,需修改以下配置:
1、查看当前selinux的状态。
/usr/sbin/sestatus
2、将SELINUX=enforcing 修改为 SELINUX=disabled 状态。
vi /etc/selinux/config
#SELINUX=enforcing #注释掉
SELINUX=disabled #新建一句
3、重启生效
reboot
评论 (0)