【问题标题】:nginx -t fails due to server_names_hash_bucket_size - but changing the size does not resolve the issuenginx -t 由于 server_names_hash_bucket_size 而失败 - 但更改大小并不能解决问题
【发布时间】:2020-09-26 17:14:39
【问题描述】:

我正在通过 AWS 使用 gunicorn 和 nginx 启动一个 Django 应用程序。我没有错误地设置了 gunicorn 配置。我在 /etc/nginx/sites-enabled 中创建了一个新的 nginx 配置,然后运行 ​​sudo nginx -t 进行测试,我收到以下错误:
nginx: [emerg] could not build server_names_hash, you should increase server_names_hash_bucket_size: 64 nginx: configuration file /etc/nginx/nginx.conf test failed

我在etc/nginx/nginx.conf 的nginx 配置中取消了server_names_hash_bucket_size: 64 的注释,这仍然没有改变我的错误,我无法重新启动我的服务器(我正在尝试设置一个主管以确保gunicorn 始终在后台运行) 供参考:
django.conf:

server { 
   listen 80; server name 34.212.49.238; 
   location / { 
      include proxy_params; 
      proxy_pass http://unix:/home/ubuntu/Django_webapp/app.sock; 
   } 
} 

我也跑了systemctl status nginx.service

我是服务器故障排除的新手,非常感谢您的帮助

【问题讨论】:

标签: ubuntu nginx server


【解决方案1】:

解决了
我在etc/nginx/sites-available 中创建了一个较旧的配置文件,我已将其删除。但是在新的配置文件中使用了相同的代码(相同的 DNS、端口等)。虽然配置文件已从etc/nginx/sites-available 中删除,但它仍然存在于etc/nginx/sites-enabled 中。因此,请仔细检查在其中一个文件中所做的所有更改是否反映在另一个文件中。

【讨论】:

    猜你喜欢
    • 2011-10-15
    • 1970-01-01
    • 2022-01-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-10-23
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多