起因是我的腾讯云小鸡突然访问巨慢,今天登上去看了下发现磁盘空间满了,其中 nginx 的 access.log 就占了 33G。
大量 log 都是类似下面这种:
121.238.181.104 - - [23/Jul/2019:17:06:15 +0800] "GET /otsmobile/app/mgs/mgw.htm?operationType=com.cars.otsmobile.queryLeftTicket&requestData=%5B%7B%22train_date%22%3A%2220190728%22%2C%22purpose_codes%22%3A%2200%22%2C%22from_station%22%3A%22CZH%22%2C%22to_station%22%3A%22ZDN%22%2C%22station_train_code%22%3A%22%22%2C%22start_time_begin%22%3A%220000%22%2C%22start_time_end%22%3A%222400%22%2C%22train_headers%22%3A%22QB%23%22%2C%22train_flag%22%3A%22%22%2C%22seat_type%22%3A%22%22%2C%22seatBack_Type%22%3A%22%22%2C%22ticket_num%22%3A%22%22%2C%22dfpStr%22%3A%22Kkc-ypSI1MmN1-xm-shsDUoFhTpNRYwoDt4q0o7Zk6yal4RFOLPEZAlkgnKaxuVWMv1gm6vaJhCzOYwvXS_KxtVXYf7foWgHKybovOoVfeGnPNUrJK4GXuUXX-S2GxNE8z-Fmdr3aGNPwBWlpePKTibGpcEuA89D%22%2C%22baseDTO%22%3A%7B%22check_code%22%3A%2299976ef2a5f0c45ca0cba6957f5add03%22%2C%22device_no%22%3A%22XTWYw2mjkUQzMGMfFr5qoFiY%22%2C%22mobile_no%22%3A%22%22%2C%22os_type%22%3A%22a%22%2C%22time_str%22%3A%2220190723170615%22%2C%22user_name%22%3A%22%22%2C%22version_no%22%3A%224.2.10%22%7D%7D%5D&ts=1563872775032&sign=2f8b45dd42d0544d64a9f7af81b1f706 HTTP/1.1" 444 0 "-" "Go-http-client/1.1"
110.218.205.25 - - [23/Jul/2019:17:06:15 +0800] "GET /otsmobile/app/mgs/mgw.htm?operationType=com.cars.otsmobile.queryLeftTicket&requestData=%5B%7B%22train_date%22%3A%2220190724%22%2C%22purpose_codes%22%3A%2200%22%2C%22from_station%22%3A%22ZYJ%22%2C%22to_station%22%3A%22LZJ%22%2C%22station_train_code%22%3A%22%22%2C%22start_time_begin%22%3A%220000%22%2C%22start_time_end%22%3A%222400%22%2C%22train_headers%22%3A%22QB%23%22%2C%22train_flag%22%3A%22%22%2C%22seat_type%22%3A%22%22%2C%22seatBack_Type%22%3A%22%22%2C%22ticket_num%22%3A%22%22%2C%22dfpStr%22%3A%22eXNvnG_dhMV52v1v7hCA8Ny47hOWo89M7Hoxg1n45OyJJ8VqnBs2AiD0lUcJSiUzEimLKNWtIYeVYr06VX2tsUA6mfgpUyNrFWaDouCRYGzmn_r138y27EC4oa-v8yK6dZHsGVGZ2F5ji4-ax4plmpGKyJGjFwvo%22%2C%22baseDTO%22%3A%7B%22check_code%22%3A%224e3333eb814f961347a92b05457a25e3%22%2C%22device_no%22%3A%22XTWYwANleQwzMHXUqoMlBfdk%22%2C%22mobile_no%22%3A%22%22%2C%22os_type%22%3A%22a%22%2C%22time_str%22%3A%2220190723170615%22%2C%22user_name%22%3A%22%22%2C%22version_no%22%3A%224.2.10%22%7D%7D%5D&ts=1563872775144&sign=9caf0e8903ead8174a45e6532f8f7404 HTTP/1.1" 444 0 "-" "Go-http-client/1.1"
所有的请求都指向/otsmobile/app/mgs/mgw.htm
。
借助搜索引擎,我发现了有文章介绍类似情况: http://niliu.me/articles/367.html
参照此文我在 nginx 的配置中添加了:
server {
listen 443 default_server;
server_name _;
ssl on;
return 444;
}
瞬间服务器就变得流畅了。
ps:确定 444 生效以后,我又添加了access_log off;
,防止 log 过大。
这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。
V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。
V2EX is a community of developers, designers and creative people.