Nginx 400 error

dinghm nginx-forum at nginx.us
Fri Feb 14 09:24:39 UTC 2014


I use nginx proxy tomcat, but there have been many 400 error, about 10%.
But do not use nginx, tomcat can normally handle this part of the request.
This is my nginx configuration : 
user                  nobody;
worker_processes      1;

error_log             logs/error.log;
pid                   logs/nginx.pid;

events {
        # use [ kqueue | rtsig | epoll | /dev/poll | select | poll ];
        use epoll;

        # web server   : max_clients = worker_processes *
worker_connections
        # proxy server : max_clients = worker_processes * worker_connections
/ 4
        worker_connections  8192;
}

http {
        include                    mime.types;
        default_type               application/octet-stream;

        log_format      main       '$remote_addr - $remote_user
[$time_local] "$request" '
                                   '$status $body_bytes_sent "$http_referer"
'
                                   '"$http_user_agent"
"$http_x_forwarded_for" |body: $request_body' ' $request_time' ' $host';

        #access_log                 logs/access.log  main;

        sendfile                    on;
        tcp_nopush                  on;

        keepalive_timeout           90;

        gzip                        on;
        gzip_comp_level             5;
        gzip_http_version           1.0;
        gzip_min_length             1024;
        gzip_buffers                4  8k;
        gzip_types                  text/plain application/x-javascript
text/css application/xml;

        client_header_buffer_size   32k;
        large_client_header_buffers 4 32k;
        #client_max_body_size     2M;
        #client_body_buffer_size   512k;
        fastcgi_intercept_errors        on;
        fastcgi_connect_timeout     300;
        fastcgi_send_timeout        300;
        fastcgi_read_timeout        300;
        fastcgi_buffers             4 256k;
        fastcgi_busy_buffers_size   256k;
        fastcgi_buffer_size         128k;
        proxy_ignore_client_abort on;

        #proxy_buffer_size    32k;
        #proxy_buffers 4 32k;
        # The following includes are specified for virtual hosts
        include        vhosts/*.conf;
}

upstream download {
        server 127.0.0.1:8001 weight=1;
}

server {
        listen       80;
        server_name 210.209.116.176 *.newlife-sh.com;
        access_log  logs/download.log main;
        location /{
             proxy_set_header Host $http_host;
             proxy_set_header X-Real-IP $remote_addr;
             proxy_set_header REMOTE-HOST $remote_addr;
        #     proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
             client_max_body_size 50m;
             client_body_buffer_size 1024k;
             proxy_intercept_errors on;
             error_page 400 error;
             proxy_connect_timeout 90;
             proxy_send_timeout 120;
             proxy_read_timeout 300;
             proxy_buffer_size 4m;
             proxy_buffers 8 1024k;
             proxy_busy_buffers_size 4m;
             proxy_temp_file_write_size 16m;
             proxy_next_upstream error timeout invalid_header http_500
http_503 http_404;
             proxy_max_temp_file_size 128m;
            proxy_pass http://download;
        }
        location /nginxstatus {
                access_log on;
                allow all;
        }
 }

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,247540,247540#msg-247540



More information about the nginx mailing list