2017-09-04 62 views
3

我已經安裝了Fedora和Ngnix,添加了所有的配置文件我的地方發展,當我開始看到這個錯誤的Nginx在Fedora 26:無法建立最佳types_hash錯誤信息

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 

我找到的解決辦法說我應該添加types_hash_bucket_sizenginx.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; 

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; 
    } 
} 
+0

我在Fedora 27上,也收到這個警告,運行Nginx的開箱即用。難道Fedora上的默認配置是錯誤的嗎? –

回答

1

在Fedora 25,我有這個問題爲好。 types_hash_max_size被設置爲2048(nginx文檔指示它默認爲1024)。我只是將它增加到4096而nginx很高興(與nginx -t檢查)。

FWIW,在我的配置中沒有與散列桶大小相關的設置。這只是默認設置。

+0

感謝這也解決了我的問題在Fedora上。 –