当我开始看到这个错误时,我已经安装了Fedora和Ngnix,为我的本地开发添加了所有配置文件
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
Run Code Online (Sandbox Code Playgroud)
我找到的解决办法说,我要补充types_hash_bucket_size到nginx.conf,但我已经添加了它,删除默认的一个,同时取出并补充这两种,它坚持表示这个错误.
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;
# I tried leaving both, removing both and one of each. The error persists.
types_hash_max_size 2048;
server_names_hash_bucket_size 128;
Run Code Online (Sandbox Code Playgroud)
types_hash_max_size 但是,当我安装nginx时默认存在.
我的文件来自sites-enabled:
server {
listen 80;
server_name devapi.hporder.com;
root /home/gabriel/Sites/hp-order-system/workspace/api;
client_max_body_size 10M;
location ~ ^/(images|javascript|js|css|flash|media|static)/ {
expires 30d;
}
location / {
index index.php index.html index.htm;
try_files $uri $uri/ /index.php$is_args$args;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/local/Cellar/nginx/1.10.1/html;
}
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_param FF_BOOTSTRAP_ENVIRONMENT dev;
fastcgi_param FF_BOOTSTRAP_CONFIG api/dev;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
# include /usr/local/etc/nginx/fastcgi.conf;
fastcgi_buffer_size 1024k;
fastcgi_buffers 1024 1024k;
fastcgi_busy_buffers_size 1024k;
}
}
Run Code Online (Sandbox Code Playgroud)
Ric*_*ael 23
在Fedora 25上,我也有这个问题.types_hash_max_size设置为2048(nginx文档表明它默认为1024).我只是把它增加到4096并且nginx很高兴(检查过nginx -t).
FWIW,在我的配置中没有与哈希桶大小相关的设置.这只是默认值.