nginx:[警告]无法构建最佳的variables_hash,您应该增加variables_hash_max_size:1024或变量散列存储桶大小:64

kx5bkwkv  于 2023-02-11  发布在  Nginx
关注(0)|答案(1)|浏览(129)

我无法正确设置Nginx哈希表。
我一直收到警告:
nginx:[警告]无法构建最佳的variables_hash,您应该增加variables_hash_max_size:1024或变量散列存储桶大小:64;忽略变量_散列_存储桶_大小
我已经通过将这些值乘以2将其增加了几倍,但它不起作用。

map_hash_max_size 4096;
map_hash_bucket_size 256;

如何纠正这个问题?

    • 以下是我的服务器配置:**
  • Debian 11版本
  • Nginx附加功能1.18.0
  • 英特尔酷睿i9 - 9900K(8核和16线程)
  • 128 GB内存DDR4
    • 以下是Nginx配置文件:**
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/*;
}
liwlm1x9

liwlm1x91#

对我有效的是:
/etc/nginx/nginx.conf

http {
    ...
    types_hash_bucket_size 128;
    ...
}

相关问题