我一直在尝试使用gunicorn在一个运行off centos 7的nginx代理后面部署一个烧瓶应用程序 . 当我尝试在浏览器中访问该应用程序时,它并没有出来 . 我是新的瓶子,枪炮,nginx所以我不确定我做错了什么 . 我正在使用vultr Cloud 托管环境托管应用程序 . 我正在学习本教程:https://www.vultr.com/docs/how-to-setup-gunicorn-to-serve-python-web-applications

但用文件夹control_search替换文件夹exampleapp并将我的python源文件control_search.py放在那里 . 该文件的结构如下:

import requests

....

from flask import Flask,render_template,request,jsonify

app = Flask(__name__)
@app.route('/')
def open_layer():
  return render_template("index.html")
@app.route('/compute',methods=['POST', 'GET'])
def compute_paths():
  ....
  ....
  ....
if __name__ == '__main__':
   app.run(debug=True)

我有一个位于control_search文件夹内的模板文件夹,其中包含index.html . 我们的想法是将index.html文件加载到浏览器中 . 我试过用两个开始gunicorn:

gunicorn -w 2 control_search:open_layer&

gunicorn -w 2 control_search:app&

无济于事 . 我的nginx配置如下:

server {
    listen       80 default_server;
    listen       [::]:80 default_server;
    server_name  _;
    root         /usr/share/nginx/html;

    # Load configuration files for the default server block.
    include /etc/nginx/default.d/*.conf;

    location / {
    proxy_set_header HOST $host;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_pass http://localhost:8000/;
    }
}

我真的很感激一些关于我应该怎样做才能让事情发挥作用的建议 . 谢谢