目前,我的 AWS 运行状况检查正在无情地打击我的服务器:
...
54.228.16.40 - - [14/Jan/2014:10:17:22 +0000] "GET / HTTP/1.1" 301 178 "-" "Amazon Route 53 Health Check Service"
54.248.220.40 - - [14/Jan/2014:10:17:24 +0000] "GET / HTTP/1.1" 301 178 "-" "Amazon Route 53 Health Check Service"
54.232.40.110 - - [14/Jan/2014:10:17:25 +0000] "GET / HTTP/1.1" 301 178 "-" "Amazon Route 53 Health Check Service"
54.241.32.78 - - [14/Jan/2014:10:17:26 +0000] "GET / HTTP/1.1" 301 178 "-" "Amazon Route 53 Health Check Service"
54.245.168.46 - - [14/Jan/2014:10:17:28 +0000] "GET / HTTP/1.1" 301 178 "-" "Amazon Route 53 Health Check Service"
54.251.31.174 - - [14/Jan/2014:10:17:28 +0000] "GET / HTTP/1.1" 301 178 "-" "Amazon Route 53 Health Check Service"
...
而且我想将 NginX 配置为不使用"Amazon Route 53 Health Check Service"
.
我目前的尝试如下:
# default server for forwarding all requests over to main www domain
server {
listen 80 default_server;
server_name _;
return 301 $scheme://www.example.com$request_uri;
}
# server configured to catch aws health check requests
server {
listen 80;
server_name 12.345.67.89;
location / {
if ( $http_user_agent ~* 'Amazon Route 53 Health Check Service' ) {
access_log off;
return 200 'Service OK';
}
}
}
# actual application server
server {
listen 80;
server_name www.example.com;
location / {
...
}
}
这对我来说看起来不错,事实上,当我 CURL 时,健康检查设置为命中相同的地址:
curl --user-agent "Amazon Route 53 Health Check Service" http://12.345.67.89:80/
我得到了我的期望:
Service OK
而且我的请求不会出现在日志中。
但是,当这些请求来自实际的 AWS 运行状况检查时,我的日志继续被淹没。
关于我在哪里做错的任何想法?
谢谢