could not build the proxy_headers_hash
Ruslan Ermilov
ru at nginx.com
Mon Mar 11 10:08:38 UTC 2013
On Mon, Mar 11, 2013 at 05:24:38AM -0400, recived wrote:
> Здравствуйте. Не могу понять как решить проблему с ошибкой:
> nginx: [emerg] could not build the proxy_headers_hash, you should increase
> either proxy_headers_hash_max_size: 512 or proxy_headers_hash_bucket_size:
> 64
> (nginx/1.1.19)
> Подскажите пожалуйста.
У вас дважды задана передача заголовка X-Forwarded-For на
проксируемый сервер, из-за этого и ошибка. (Сообщение об
ошибке возможно следует сделать более явным.)
> ------------------------------------------------------------------------------------------------
> nginx.conf
> ------------------------------------------------------------------------------------------------
> user www-data;
> worker_processes 4;
> pid /var/run/nginx.pid;
>
> events {
> worker_connections 768;
> # multi_accept on;
> }
>
> http {
> ##
> # Basic Settings
> ##
> sendfile on;
> tcp_nopush on;
> tcp_nodelay on;
> keepalive_timeout 65;
> types_hash_max_size 2048;
> # server_tokens off;
>
> include /etc/nginx/mime.types;
> default_type application/octet-stream;
> server_names_hash_bucket_size 64;
> server_names_hash_max_size 512;
> ##
> # Logging Settings
> ##
> log_format main '$host $remote_addr [$time_local] "$request" $status
> $body_bytes_sent "$http_referer" "$http_user_agent"';
> access_log /var/log/nginx/access.log;
> error_log /var/log/nginx/error.log;
>
> ##
> # Gzip Settings
> ##
>
> gzip on;
> gzip_disable "msie6";
>
> ##
> # Virtual Host Configs
> ##
> include /etc/nginx/conf.d/*.conf;
> include /etc/nginx/sites-enabled/*;
> }
>
> ------------------------------------------------
> mysite.tpl
> ------------------------------------------------
> server {
> listen 80;
> server_name mysite.tpl;
> access_log /var/www/mysite.tpl/logs/access_ng.log;
> error_log /var/wwwsite/mysite.tpl/logs/error_ng.log;
>
> location ~* \.(gif|png|css|zip|swf|ico|flv|jpg)$ {
> root /var/wwwsite/mysite.tpl/www/;
> #index index.html index.php;
> access_log off;
> expires max;
>
> gzip on;
> gzip_comp_level 5;
> gzip_vary on;
> gzip_static on;
> gzip_types text/css text/plain application/json application/x-javascript
> text/xml application/xml application/xml+rss text/javascript
> application/javascript text/x-js application/x-shockwave-flash;
> gzip_min_length 1024;
> gzip_disable "msie6";
> gzip_proxied any;
>
> }
> location / {
> proxy_pass http://192.168.4.250:82/;
> proxy_set_header X-Real-IP $remote_addr;
> proxy_set_header Host $host;
> proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
> proxy_set_header X-Forwarded-for $remote_addr;
> proxy_set_header Host $host;
> proxy_connect_timeout 60;
> proxy_send_timeout 90;
> proxy_read_timeout 90;
> proxy_redirect off;
> }
> }
Подробная информация о списке рассылки nginx-ru