mysql - nginx connect() failed (110: Connection timed out) -


i know that, question has been asked multiple times on different forums, still can not manage find solution, solves problem... situation: have nginx, php-fpm , mysql stack on server. server sits behind nginx reverse proxy. problem on upstream server there clean error logs , on reverse proxy getting multiple messages

connect() failed (110: connection timed out) while connecting >upstream, client: ++++++++++, server: domain.com, request: "get >/files/imagecache/frontbullet/blog1/dknasda.jpg http/1.1", upstream: >"http://192.168.158.142:80/files/imagecache/frontbullet/blog1/dknasda.jpg>", host: "somedomain.com"

for reason error occurs every 1-5 minutes different resources or files.

my nginx config on reverse proxy following 1 :

    user ++++; worker_processes 3; error_log /var/log/nginx/error.log; pid /run/nginx.pid;  events {     worker_connections 1024;     use epoll; }  http {     log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '                   '$status $body_bytes_sent "$http_referer" '                   '"$http_user_agent" "$http_x_forwarded_for"';      access_log  /var/log/nginx/access.log  main;      sendfile            on;     tcp_nopush          on;     tcp_nodelay         on;     keepalive_timeout   60s; #keeps connection open client; ms default 60.     types_hash_max_size 2048;      include             /etc/nginx/mime.types;     default_type        application/octet-stream;      gzip on;      gzip_http_version 1.1;      gzip_vary on;      gzip_comp_level 6;      gzip_proxied any;      gzip_types text/plain  text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript text/x-js;      gzip_buffers 16 8k;      gzip_disable "msie [1-6]\.(?!.*sv1)";      upstream main_upstream {          server 192.168.158.142:80 max_fails=3  fail_timeout=60s;  #       new server. sent 192.168.90 #   server 192.168.158.143:80;   #       hsb     keepalive 32;     }  server {     listen       80 default_server;     listen       [::]:80 default_server;     server_name  domain.com;      location / {         proxy_buffers 32 32k;         proxy_buffer_size 64k;         proxy_pass http://main_upstream;         proxy_set_header    host $host;         proxy_set_header    x-forwarded-for $proxy_add_x_forwarded_for;         proxy_set_header    x-forwarded-proto $scheme;         proxy_set_header    x-forwarded-by $server_addr:$server_port;             proxy_set_header    x-real-ip $remote_addr;         proxy_connect_timeout       600s;         proxy_send_timeout          600s;         proxy_read_timeout          600s;         send_timeout                600s;         proxy_http_version 1.1;         proxy_set_header connection "";         client_max_body_size                            32m;         client_body_buffer_size                         512k;     }     error_page 404 /404.html;         location = /40x.html {     }      error_page 500 502 503 504 /50x.html;         location = /50x.html {     } } 

any idea why happening? using centos 7.1 abd nginx 1.6.3

thanks in advance, todor

finally found reason , has been clean hours now. turned out there 2 overlapping problems. first 1 kernel dropping requests after queue full. here nice manual tuning kernel linux kernel parameters - https://www.nginx.com/blog/tuning-nginx/

after problems started migrated site new server , used dhcp assign ip address - big mistake. every hour or dhcp restarted network interface. examining entire system log noticed ip of network interface reassigned on regular intervals. intervals coincided bursts of errors in log. solution go static ips.


Comments

Popular posts from this blog

java - Suppress Jboss version details from HTTP error response -

gridview - Yii2 DataPorivider $totalSum for a column -

Sass watch command compiles .scss files before full sftp upload -