nginx:[emerg]无法构建referer_hash,您应该增加referer_hash_bucket_size:64

nginx:[emerg]无法构建referer_hash,您应该增加referer_hash_bucket_size:64

再会,

我是编程新手,我正在尝试运行 livehelperchat 开源代码(https://livehelperchat.com/)在我的 ubuntu-16.04 实例中,我将 Nginx 作为默认服务器侦听端口 80,并且还运行 php 5.6。

我的/var/www/html/sites-enabled/default

        server {
        listen 80 default_server;
        listen [::]:80 default_server ipv6only=on;

        root /var/www/html;
        index index.php index.html index.htm index.nginx-debian.html;

        server_name xxxxxxxxx;

        location / {
            try_files $uri $uri/ =404;
        }

        error_page 404 /404.html;
        error_page 500 502 503 504 /50x.html;
        location = /50x.html {
            root /var/www/html;
        }

        location ~ \.php$ {
            try_files $uri =404;
            fastcgi_split_path_info ^(.+\.php)(/.+)$;
            fastcgi_pass unix:/var/run/php5.6-fpm.sock;
            fastcgi_index index.php;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    #        fastcgi_param SCRIPT_FILENAME /usr/share/nginx/html$fastcgi_script_name;
            include fastcgi_params;
        }
    }

我可以通过访问我的服务器的域名或公共IP地址,然后访问/info.php,在我的网络浏览器中访问php信息页面

我的代码位于 /var/www/html/livehelperchat/ 我已使用以下链接在 nginx 中设置项目 https://livehelperchat.com/nginx-configuration-tips-132a.html

我的 /var/www/html/sites-enabled/example.conf

       server {
        listen          80;
        server_name     xxxxxxxxxxxxxxxxxxxxxxxxxxx;
        root           /var/www/html/livehelperchat;
        location ~* (^(?!(?:(?!(php)).)*/(albums|bin|var|lib|cache|doc|settings|pos|modules)/).*?(index\.php|upgrade\.php)$) {
            include        /etc/nginx/livehelperchat_fastcgi_params;
            fastcgi_pass   unix:/var/run/php5.6-fpm.sock;

            fastcgi_index  index.php;
            fastcgi_param  PATH_INFO  $query_string;
           # fastcgi_param  SCRIPT_FILENAME /var/livehelperchat/$fastcgi_script_name;
             fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        }
        #Allow hotlinking to normal and thumb size images
        location ~* (normal_|thumb_|^/design|^/cache|^/var/storagetheme)(.*)\.(gif|jpe?g?|png|mp3|svg|otf|woff|eot|ttf|ogg|wav|bmp|htm|swf|css|js|swf|pdf|ico)$ {
            ## @todo: add expires headers...
            # favicon is only stored in 1 dir, the design one; But browsers ask for it in the root
            if ($http_user_agent ~* "(WebReaper|wget|SiteSucker|SuperBot|Mihov Picture Downloader|TALWinHttpClient|A1 Website Download|WebCopier|Download Ninja|Microsoft URL Control|GetRight|Arachmo|MJ12bot|Gaisbot|Anonymous|Yanga|Twiceler|psbot|Irvine|Indy Library|HTTrack)" ) {
                return 403;
            }
            if ($http_referer ~* (stockingteensex.info|cbox.ws|teensos.net|dpstream.net|tagged.com|kaskus.us|gorilladatingservice.info|taringa.net|discuss.com|craigslist.org|poringa.net)) {
                return 403;
            }
            #sendfile off;
            #aio on;
            directio 512;
            expires max;
            access_log off;
             root           /var/www/html/livehelperchat;
        }
        # Do not allow to hotlink full size images except our self and major search engines
        location ~* \.(gif|jpe?g?|png|bmp|swf|css|js|svg|otf|eot|ttf|woff|swf|mp3|ogg|wav|pdf|ico|txt)$ {
            ## @todo: add expires headers...
            valid_referers none blocked server_names ~(livehelperchat.com|google.|reddit.|bing.|yahoo.);
            if ($invalid_referer) {
                return 403;
            }
            if ($http_user_agent ~* "(WebReaper|wget|SiteSucker|SuperBot|Mihov Picture Downloader|TALWinHttpClient|A1 Website Download|WebCopier|Download Ninja|Microsoft URL Control|GetRight|Arachmo|MJ12bot|Gaisbot|Anonymous|Yanga|Twiceler|psbot|Irvine|Indy Library|HTTrack)" ) {
                return 403;
            }
            if ($http_referer ~* (stockingteensex.info|cbox.ws|teensos.net|dpstream.net|tagged.com|kaskus.us|gorilladatingservice.info|taringa.net|discuss.com|craigslist.org|poringa.net)) {
                return 403;
            }
            #sendfile off;
            #aio on;
            directio 512;
            expires max;
             root           /var/www/html/livehelperchat;
        }
        location / {
            rewrite "^(.*)$" "/index.php?$1" last;
        }
    }

现在我在执行 nginx -t 时遇到错误

nginx: [emerg] could not build referer_hash, you should increase referer_hash_bucket_size: 64
nginx: configuration file /etc/nginx/nginx.conf test failed

非常感谢任何帮助。提前致谢

相关内容