gpt4 book ai didi

django - nginx:在 "localhost:8004"指令的 "listen"中找不到 [emerg] 主机

转载 作者:行者123 更新时间:2023-12-04 23:44:35 25 4
gpt4 key购买 nike

我正在使用 nginx 开发一个 django 驱动的应用程序和 gunicorn .
一切都很好,直到今天我试图重新启动 nginx哪个失败了。所以我用 sudo nginx -t 测试了它命令,我收到此错误。

nginx: [emerg] host not found in "localhost:8004" of the "listen" directive in
/etc/nginx/sites-enabled/808:2
nginx: configuration file /etc/nginx/nginx.conf test failed

这是 808配置文件内容:
server {
listen localhost:8004;
error_log /var/www/html/burger808/error.log;

location / {
proxy_pass http://127.0.0.1:8005;
proxy_set_header X-Forwarded-Host $server_name;
proxy_set_header X-Real-IP $remote_addr;
add_header P3P 'CP="ALL DSP COR PSAa PSDa OUR NOR ONL UNI COM NAV"';
}

location /static/ {
autoindex on;
alias /var/www/html/burger808/burger808/static/;
}
location /media/ {
autoindex on;
alias /var/www/html/burger808/burger808/media/;
}
}

我认为这可能与 8004 有冲突港口。所以我检查了其他配置文件,没有冲突。

我想知道是什么导致了这个错误?

最佳答案

不需要 localhost:8004 .唯一需要的是

listen 8004;

关于django - nginx:在 "localhost:8004"指令的 "listen"中找不到 [emerg] 主机,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31637904/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com