Nginx无法启动,说“无法构建测试test_types_hash”

这是我的nginx.conf:

user www-data;
worker_processes 1;
worker_rlimit_nofile 8192;

error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;

events {
    worker_connections 2048;
    # debug_connection 192.168.1.1;
    # multi_accept on;
}

http {
    server_tokens off;
    include mime.types;

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

    sendfile on;
    tcp_nodelay on;

    gzip on;

    # http://wiki.nginx.org/HttpGzipModule#gzip_disable
    gzip_disable "msie6";
    gzip_types text/javascript text/css text/plain text/xml application/xml application/xml+rss application/x-javascript;

    include /etc/nginx/conf.d/*.conf;
    include /etc/nginx/sites-enabled/*.ngx;

    #tcp_nopush on;
    #keepalive_timeout  0;
}

当我尝试启动nginx时,这就是我所看到的:

nginx: [warn] duplicate MIME type "text/javascript" in /etc/nginx/nginx.conf:27
nginx: [emerg] could not build the test_types_hash, you should increase either test_types_hash_max_size: 2048 or test_types_hash_bucket_size: 64

这种相同的配置以前没有问题.我错过了什么?

最佳答案
在我的头撞到墙上几分钟之后,我只是决定“哎呀,我会解决第一个错误并看看会发生什么.”瞧,在gzip_types声明中删除无关的text / javascript MIME类型修复了问题.

希望这有用!

转载注明原文:Nginx无法启动,说“无法构建测试test_types_hash” - 代码日志