Reputation: 1
I can't set the Nginx hash tables correctly.
I keep getting this warning:
nginx: [warn] could not build optimal variables_hash, you should increase either variables_hash_max_size: 1024 or variables_hash_bucket_size: 64; ignoring variables_hash_bucket_size
I have increased the values several times by multiplying them by two but it does not work.
map_hash_max_size 4096;
map_hash_bucket_size 256;
How to correct this problem?
Here is my server configuration:
Here is the Nginx config file:
user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;
events {
worker_connections 768;
# multi_accept on;
}
http {
### global ###
server_tokens off;
keepalive_requests 100;
### tcp ###
tcp_nopush on;
tcp_nodelay on;
sendfile on;
### timeouts ###
reset_timedout_connection on;
client_body_timeout 12;
client_header_timeout 12;
keepalive_timeout 15;
send_timeout 10;
### buffers ###
types_hash_max_size 4096;
server_names_hash_bucket_size 128;
map_hash_max_size 4096;
map_hash_bucket_size 256;
client_max_body_size 20M;
include /etc/nginx/mime.types;
default_type application/octet-stream;
### ssl ###
ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; # Dropping SSLv3, ref: POODLE
ssl_prefer_server_ciphers on;
ssl_certificate /etc/cloudflare/cloudflare.com.pem;
ssl_certificate_key /etc/cloudflare/cloudflare.com.key;
### LIMIT CONNEXION ###
limit_req_zone $binary_remote_addr zone=reqlimit:100m rate=10r/s;
limit_req_status 429;
limit_conn_zone $binary_remote_addr zone=connlimit:100m;
limit_conn_status 429;
### STATUS HTTP ###
map $status $status_text {
400 'Bad Request';
401 'Unauthorized';
402 'Payment Required';
403 'Forbidden';
404 'Not Found';
405 'Method Not Allowed';
406 'Not Acceptable';
407 'Proxy Authentication Required';
408 'Request Timeout';
409 'Conflict';
410 'Gone';
411 'Length Required';
412 'Precondition Failed';
413 'Payload Too Large';
414 'URI Too Long';
415 'Unsupported Media Type';
416 'Range Not Satisfiable';
417 'Expectation Failed';
418 'I\'m a teapot';
421 'Misdirected Request';
422 'Unprocessable Entity';
423 'Locked';
424 'Failed Dependency';
425 'Too Early';
426 'Upgrade Required';
428 'Precondition Required';
429 'Too Many Requests';
431 'Request Header Fields Too Large';
451 'Unavailable For Legal Reasons';
500 'Internal Server Error';
501 'Not Implemented';
502 'Bad Gateway';
503 'Service Unavailable';
504 'Gateway Timeout';
505 'HTTP Version Not Supported';
506 'Variant Also Negotiates';
507 'Insufficient Storage';
508 'Loop Detected';
510 'Not Extended';
511 'Network Authentication Required';
default 'Something is wrong';
}
### Virtual Host Configs ###
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
Upvotes: 3
Views: 9413
Reputation: 3055
This made my warning disappear. add this on your /etc/nginx/nginx.conf
http {
# Increase the maximum size of the hash table
proxy_headers_hash_max_size 1024;
# Increase the bucket size of the hash table
proxy_headers_hash_bucket_size 128;
# Other HTTP configuration directives...
}
Upvotes: 5
Reputation: 8202
What worked for me was:
/etc/nginx/nginx.conf
http {
...
types_hash_bucket_size 128;
...
}
Upvotes: 1