This is my first question! Few days ago I discovered that something go wrong with nginx: domains A-C are ok, others timeout. Later: others domains are ok and first timeout; or each domain work fine. If I restart nginx - nothing change. After rebooting everything works fine.
Maybe the reason is that sometimes it's too many visitors and nginx drop connections that it can't handle? (Previously there was apache and it occasionally freezed VDS). But no errors in logs, nothing. In top output I see that there is only 2-4 mb of swap space used.
It's: arch linux, nginx, php-fpm.
config file: user http http;
worker_processes 1;
error_log /var/log/nginx/nginx.error.log;
events {
worker_connections 2048;
}
http {
include mime.types;
default_type application/octet-stream;
error_log /var/log/nginx/http.error.log;
sendfile on;
gzip on;
gzip_static on;
gzip_vary on;
client_body_buffer_size 1k;
client_header_buffer_size 1k;
client_max_body_size 5m;
large_client_header_buffers 2 1k;
client_body_timeout 10;
client_header_timeout 10;
keepalive_timeout 5 5;
send_timeout 10;
server {
listen 80;
server_name www.A.com www.B.org www.F.net;
if ($host ~* ^www\.(.+)) {set $domain $1;}
return 301 $scheme://$domain$request_uri;
}
server {
listen 80;
server_name A.com *.A.com B.org F.net;
root /home/user/public_html/$host;
access_log /var/log/nginx/$host-access.log;
error_log /var/log/nginx/server.error.log;
location / {
try_files $uri $uri/ /index.php?$args;
index index.html index.htm index.php;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
location ~ \.php$ {
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
try_files $uri =404;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
}
And of course, I think that I must to find the reason, not only fix the problem.
Many Thanks!