![AWS Ubuntu 11.10 EC2 上的低流量 Nginx,通过 monit 测试时返回 499,为什么?](https://linux22.com/image/615705/AWS%20Ubuntu%2011.10%20EC2%20%E4%B8%8A%E7%9A%84%E4%BD%8E%E6%B5%81%E9%87%8F%20Nginx%EF%BC%8C%E9%80%9A%E8%BF%87%20monit%20%E6%B5%8B%E8%AF%95%E6%97%B6%E8%BF%94%E5%9B%9E%20499%EF%BC%8C%E4%B8%BA%E4%BB%80%E4%B9%88%EF%BC%9F.png)
我有一个流量非常低的 Nginx 机器,用作外部服务的反向代理。机器上安装了 Monit,nginx
如果崩溃了,它会重新启动。不用说,nginx
这台机器每天至少会停止一次,monit
必须重新启动它。
这是我的monit
配置:
check process nginx with pidfile /var/run/nginx.pid
start program = "/etc/init.d/nginx start"
stop program = "/etc/init.d/nginx stop"
if cpu > 60% for 2 cycles then alert
if cpu > 80% for 25 cycles then restart
if totalmem > 400.0 MB for 5 cycles then restart
if children > 250 then restart
if loadavg(5min) greater than 10 for 8 cycles then stop
if failed host 127.0.0.1 port 80 protocol http
then restart
if 3 restarts within 5 cycles then timeout
这是我的网站配置nginx
:
server {
listen 80;
server_name somedomainname.com;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
location / {
proxy_pass https://somedomainname.com;
proxy_redirect off;
client_max_body_size 10m;
client_body_buffer_size 128k;
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffer_size 4k;
proxy_buffers 4 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
}
}
答案1
您的问题可能是由于monit
未发送“Host:”标头字段造成的。请尝试通过设置一个未使用代理的监控器来location
解决这个问题:monit
location = /test_target.html {
root /var/www/public;
}
(我通过搜索找到了这个答案nginx 监控 499。这是第一个结果。)