[Solved] Nginx on Fedora – warn could not build optimal types_hash message

When trying to setup Nginx on Fedora with php-fpm there is a weird warning message when testing with command nginx -t on the terminal

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
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

To solve this problem just increase the size of type_hash_max_size in the nginx.conf.

The default type_hash_max_size was set with 2048 in the nginx conf file (/etc/nginx/nginx.conf)

Increase this value to 4096 and update the conf file then the warning will go off.

Nginx Warning solved

The segment of nginx.conf is given below.

http {
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';

access_log /var/log/nginx/access.log main;

sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 4096;

This will sove the problem. This problem is there from Fedora 26 to Fedora 31.

Source: Stackoverflow

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.