如何解决nginx: [emerg] 无法构建 server_names_hash,你应该增加 server_names_hash_bucket_size
由于域名过长,这很可能发生。您可以通过添加来解决此问题
server_names_hash_bucket_size 64;
在您的http
街区顶部(可能位于/etc/nginx/nginx.conf
)。我从 nginx 文档中引用了出现此错误时该怎么做:In this
case, the directive value should be increased to the next power of two
.
因此,在您的情况下,它应该变为 64。
如果您仍然遇到相同的错误,请尝试增加到 128 或更多。
参考: http://nginx.org/en/docs/http/server_names.html#optimization
解决方法
我正在设置新服务器。我选择的 http-Server 是 NGINX。我想将域添加audi-freunde-einbeck.de
为虚拟主机。我那里已经有
2 个其他域并且工作正常,但是当我尝试添加上述域并启动服务器时,它给了我Job failed. See system journal and
'systemctl status' for details.
我认为这是因为破折号,所以我尝试了带有和不带连字符的各种其他域,但没有运气。同样的错误。是什么原因造成的?我也试过重启,我真的很茫然。任何帮助将不胜感激。
我玩了一会儿发现,当我只放入一个域时,它就可以工作。但是当我放入另一个域时,它就停止了。这是状态的输出:
[root@netzmelone nginx]# systemctl status nginx
nginx.service - A high performance web server and a reverse proxy server
Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled)
Active: failed (Result: exit-code) since Sun,16 Dec 2012 11:38:08 +0000; 7s ago
Process: 14239 ExecStop=/usr/sbin/nginx -g pid /run/nginx.pid; -s quit (code=exited,status=1/FAILURE)
Process: 14232 ExecStart=/usr/sbin/nginx -g pid /run/nginx.pid; daemon on; master_process on; (code=exited,status=0/SUCCESS)
Process: 14242 ExecStartPre=/usr/sbin/nginx -t -q -g pid /run/nginx.pid; daemon on; master_process on; (code=exited,status=1/FAILURE)
Main PID: 14234 (code=exited,status=0/SUCCESS)
CGroup: name=systemd:/system/nginx.service
Dec 16 11:38:08 netzmelone nginx[14242]: nginx: [emerg] could not build the server_names_hash,you should increase server_names_hash_bucket_size: 32
Dec 16 11:38:08 netzmelone nginx[14242]: nginx: configuration file /etc/nginx/nginx.conf test failed
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。