问题描述
某日重启Nginx出现如下告警:
[root@localhost ~]# systemctl status nginx
8月 16 14:16:13 localhost systemd[1]: Starting The nginx HTTP and reverse proxy server...
8月 16 14:16:13 localhost nginx[2116]: nginx: [warn] could not build optimal types_hash, you should increase either types_hash_max_size: 2048 or types_hash_bucket_size: 64; ignoring types_hash_bucket_size
8月 16 14:16:13 localhost nginx[2116]: nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
8月 16 14:16:13 localhost nginx[2116]: nginx: configuration file /etc/nginx/nginx.conf test is successful
8月 16 14:16:13 localhost nginx[2116]: nginx: [warn] could not build optimal types_hash, you should increase either types_hash_max_size: 2048 or types_hash_bucket_size: 64; ignoring types_hash_bucket_size
8月 16 14:16:13 localhost systemd[1]: Started The nginx HTTP and reverse proxy server.
Nginx配置文件也出现上述告警
解决办法
在Nginx.conf的http模块下增加:
types_hash_max_size 4096;
通过Nginx -t
不在出现告警,重启Nginx服务也恢复正常。