Здравствуйте.
Был сайт Wordpress на сервере Nginx.
Месяцев 5-6 все работало нормально, месяц назад стабильно начали вылететь ошибки 502.
В логах была /var/log/error.log такая ошибка
2016/01/18 03:58:54 [error] 13245#0: *125039 connect()
to unix:/var/run/php5-fpm.sock failed (11: Resource temporarily unavailable) while connecting to upstream,
client: 74.217.28.153, server: www.d2battle.club, request: "POST /xmlrpc.php HTTP/1.0", upstream:
"fastcgi://unix:/var/run/php5-fpm.sock:", host: "188.166.31.15"
Погуглил и нашел следующий совет
Совет
Перезапустил сервер - все заработало, на следующий день вылетела ошибка 504.
В логе было следующее.
2016/01/19 02:37:38 [error] 3677#0: *5484 upstream timed out (110: Connection timed out)
while reading response header from upstream, client: 66.249.66.148, server: www.d2battle.club, request:
"GET /done_battles/11/ HTTP/1.1", upstream: "fastcgi://127.0.0.1:7777", host: "d2battle.club
Перед этой ошибкой была пара тройка следующих сообщений
2016/01/18 04:43:23 [crit] 13245#0: *125168 connect() to unix:/var/run/php5-fpm.sock failed (2: No such file or directory)
while connecting to upstream, client: 176.209.206.24, server: www.d2battle.club, request: "GET /favicon.ico HTTP/1.1",
upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "d2battle.club", referrer: "http://d2battle.club/"
Конфигурационный файл nginx.conf не трогал.
user www-data; worker_processes 4; pid /run/nginx.pid;
events { worker_connections 768; # multi_accept on; }
http {
sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 65; types_hash_max_size 2048; # server_tokens off;
# server_names_hash_bucket_size 64; # server_name_in_redirect off;
include /etc/nginx/mime.types; default_type application/octet-stream;
## # Logging Settings ##
access_log /var/log/nginx/access.log; error_log /var/log/nginx/error.log;
## # Gzip Settings ##
gzip on; gzip_disable "msie6";
# gzip_vary on; # gzip_proxied any; # gzip_comp_level 6; # gzip_buffers 16 8k; # gzip_http_version 1.1; # gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
## # nginx-naxsi config ## # Uncomment it if you installed nginx-naxsi ##
#include /etc/nginx/naxsi_core.rules;
## # nginx-passenger config ## # Uncomment it if you installed nginx-passenger ## #passenger_root /usr; #passenger_ruby /usr/bin/ruby;
## # Virtual Host Configs ##
include /etc/nginx/conf.d/.conf; include /etc/nginx/sites-enabled/; }
Поспрашивал на форуме Digitalocean посоветовали следующее
put server_name after listen in defaults
change a value in /etc/php5/fpm/pool.d/www.conf so its request_terminate_timeout=30s
change a value in /etc/php5/fpm/php.ini so its max_execution_time = 30
Последовал совету, сервер проработал 3 дня без ошибки.
Сейчас ошибка 504 вылетает каждые 5 минут примерно - не понимаю в чем причина.
nginx/error.log
2016/01/29 02:43:01 [error] 3632#0: *3918 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 176.209.192.39, server: www.d2battle.club, request: "GET /favicon.ico HTTP/1.1", upstream: "fastcgi://127.0.0.1:7777", host: "d2battle.club", referrer: "http://d2battle.club/wp-admin/plugins.php?action=delete-selected&checked%5B0%5D=wp-super-edit%2Fwp-super-edit.php&plugin_status=all&paged=1&s&_wpnonce=852a3bede6"
/var/log/upstart/php5-fpm.log
[29-Jan-2016 02:53:25] WARNING: [pool www] child 3765 exited on signal 15 (SIGTERM) after 50.005905 seconds from start
[29-Jan-2016 02:53:25] NOTICE: [pool www] child 3768 started
[29-Jan-2016 02:54:25] WARNING: [pool www] child 3753, script '/home/webmaster/www/www.d2battle.club/xmlrpc.php' (request: "POST /xmlrpc.php") execution timed out (30.781351 sec), terminating
[29-Jan-2016 02:54:25] WARNING: [pool www] child 3753 exited on signal 15 (SIGTERM) after 480.050784 seconds from start
[29-Jan-2016 02:54:25] NOTICE: [pool www] child 3769 started
[29-Jan-2016 02:55:45] WARNING: [pool www] child 3762, script '/home/webmaster/www/www.d2battle.club/xmlrpc.php' (request: "POST /xmlrpc.php") execution timed out (34.839108 sec), terminating
[29-Jan-2016 02:55:45] WARNING: [pool www] child 3762 exited on signal 15 (SIGTERM) after 330.039058 seconds from start
[29-Jan-2016 02:55:45] NOTICE: [pool www] child 3770 started
Не знаю что и делать.