location /elb-status {
access_log off;
return 200;
}
您只需更改
Ping Path
成为
/elb-status
content-type
由于默认为
application/octet-stream
location /elb-status {
access_log off;
return 200 'your text goes here';
add_header Content-Type text/plain;
}
如果您想对照用户代理进行检查,可以使用类似的方法:
set $block 1;
# Allow all the ELB health check agents.
if ($http_user_agent ~* '^ELB-HealthChecker\/.*$') {
set $block 0;
}
if (!$http_x_forwarded_for) {
set $block 1
}
if ($block = 1) {
auth_basic 'Please enter ID and password';
auth_basic_user_file /usr/src/redmine/.htpasswd;
}