Nginx server access Log a large number of Bad request error resolution _nginx

Source: Internet
Author: User
Tags nginx server

There are a large number of 400 errors in the Access.log, and an increase of hundreds of M per day, taking up a lot of space.

Copy Code code as follows:

Tail-f/opt/nginx/logs/access.log

116.236.228.180--[15/dec/2010:11:00:15 +0800] "-" 400 0 "-" "-"
116.236.228.180--[15/dec/2010:11:00:15 +0800] "-" 400 0 "-" "-"
116.236.228.180--[15/dec/2010:11:00:15 +0800] "-" 400 0 "-" "-"
116.236.228.180--[15/dec/2010:11:00:15 +0800] "-" 400 0 "-" "-"
116.236.228.180--[15/dec/2010:11:00:15 +0800] "-" 400 0 "-" "-"
119.97.196.7--[15/dec/2010:11:00:16 +0800] "-" 400 0 "-" "-"
119.97.196.7--[15/dec/2010:11:00:16 +0800] "-" 400 0 "-" "-"
116.236.228.180--[15/dec/2010:11:00:16 +0800] "-" 400 0 "-" "-"
116.236.228.180--[15/dec/2010:11:00:16 +0800] "-" 400 0 "-" "-"
116.236.228.180--[15/dec/2010:11:00:16 +0800] "-" 400 0 "-" "-"
116.236.228.180--[15/dec/2010:11:00:16 +0800] "-" 400 0 "-" "-"
116.236.228.180--[15/dec/2010:11:00:16 +0800] "-" 400 0 "-" "-"
116.236.228.180--[15/dec/2010:11:00:16 +0800] "-" 400 0 "-" "-"
116.236.228.180--[15/dec/2010:11:00:16 +0800] "-" 400 0 "-" "-"
116.236.228.180--[15/dec/2010:11:00:16 +0800] "-" 400 0 "-" "-"
219.243.95.197--[15/dec/2010:11:00:16 +0800] "-" 400 0 "-" "-"
116.236.228.180--[15/dec/2010:11:00:16 +0800] "-" 400 0 "-" "-"
116.236.228.180--[15/dec/2010:11:00:16 +0800] "-" 400 0 "-" "-"


A lot of articles on the Internet that is the HTTP head/cookie caused by too much, you can modify the nginx.conf two parameters to amend.
Copy Code code as follows:

Client_header_buffer_size 16k;
Large_client_header_buffers 4 32k;

After modification
Copy Code code as follows:

Client_header_buffer_size 64k;
Large_client_header_buffers 4 64k;

No effect, even if I nginx0.7.62 up to the latest 0.8.54 also failed to solve.
In the official forum Nginx authors mention that the null host header does not return a custom status code and is a 400 error.
http://forum.nginx.org/read.php?2,9695,11560

The final amendment is as follows
Change to original value

Copy Code code as follows:

Client_header_buffer_size 16k;
Large_client_header_buffers 4 32k;

Close the default host's logging to resolve the problem
Copy Code code as follows:

server {
Listen *:80 default;
server_name _;
return 444;
Access_log off;
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.