【发布时间】:2020-11-06 10:56:23
【问题描述】:
我正在 Linode Ubuntu 服务器上部署我的烧瓶应用程序。我在 YouTube 上使用 Corey Schafer 的 Flask 系列播放列表。但是我被困在我必须在 nginx 配置文件上设置以使 nginx 与 gunicorn 一起工作的部分。我的配置文件位于/etc/nginx/sites-enabled/flask,配置为:
server {
listen 80;
hostname ashkan-tools.de;
location /static {
alias /home/admin/flask/static;
}
location / {
proxy_pass http://localhost:8000;
include /etc/nginx/proxy_params;
proxy_redirect off;
}
}
ashkan-tools.de 是我已经与 Linode 名称服务器连接并设置 rDNS 的域。我已经尝试过www.ashkan-tools.de 甚至是 Linode 服务器的 IP。我使用sudo nginx -t -c /etc/nginx/nginx.conf从 nginx.conf 文件中得到了这个错误代码
nginx: [emerg] unknown directive "hostname" in /etc/nginx/sites-enabled/flask:3
nginx: configuration file /etc/nginx/nginx.conf test failed
每次我尝试使用 sudo service nginx restart 重新启动 nginx 服务时,都会收到以下错误代码:
Job for nginx.service failed because the control process exited with error code.
See "systemctl status nginx.service" and "journalctl -xe" for details.
我什至尝试使用sudo lsof -i:80 查看所有使用端口 80 的应用程序,但该命令没有显示任何内容。
【问题讨论】:
-
您在哪里看到
hostname指令?它在 nginx 文档中吗? -
改成
server_name
标签: python ubuntu nginx flask gunicorn