我正在尝试按照此指南部署烧瓶服务器:https ://medium.com/ymedialabs-innovation/deploy-flask-app-with-nginx-using-gunicorn-and-supervisor-d7a93aa07c18
我遵循了所有步骤,除了我完全跳过的主管部分,因为该命令不起作用,但只是让事情正常工作并不重要。
当我运行时:sudo nginx -t
我得到:nginx: [emerg] socket() [::]:80 failed (97: Address family not supported by protocol)
什么是问题?我见过其他人收到此错误,但解决方案似乎对我不起作用?
这是我的 nginx 配置文件:
server {
listen 80;
server_name <name>;
location / {
proxy_pass http://127.0.0.1:8000;
}
}
#
# A virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias;
# location / {
# root html;
# index index.html index.htm;
# }
#}
和 python 烧瓶服务器:
from flask import Flask
from flask import render_template
from flask import send_file
app = Flask(__name__, static_url_path="/static", static_folder="/static")
app.static_folder = 'static'
@app.route("/")
def index():
return render_template("index.html")
@app.route("/uploads/resume")
def download_resume():
return send_file("static/documents/resume.pdf")
if __name__ == '__main__':
app.run(port=5010, debug=False, host='0.0.0.0')