php-fpm or nginx: bad gateway
- by John Tate
I'm getting a bad gateway error all the sudden for a site. I didn't change the configuration for the site, I just added a new server config where I put them under /etc/nginx/servers and it stopped working. The new server works, and there is no conflict between the php-fpm listen addresses.
server {
listen 80;
server_name obfuscated.onion;
location = / {
root /var/www/sites/obfuse;
index index.php;
}
location / {
root /var/www/sites/obfuse;
index index.php;
if (!-f $request_filename) {
rewrite ^(.*)$ /index.php?q=$1 last;
break;
}
if (!-d $request_filename) {
rewrite ^(.*)$ /index.php?q=$1 last;
break;
}
}
error_page 404 /index.php;
location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico)$ {
root /var/www/sites/obfuse;
access_log off;
expires 30d;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /var/www/sites/obfuse$fastcgi_script_name;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param PATH_INFO $fastcgi_script_name;
include fastcgi_params;
}
}
There is nothing unusual in php-fpm's log even when I raised the level to debug.
[24-Jun-2013 09:10:37.357943] DEBUG: pid 6756, fpm_scoreboard_init_main(), line 40: got clock tick '100'
[24-Jun-2013 09:10:37.358950] DEBUG: pid 6756, fpm_event_init_main(), line 333: event module is kqueue and 1 fds have been reserved
[24-Jun-2013 09:10:37.358978] NOTICE: pid 6756, fpm_init(), line 83: fpm is running, pid 6756
[24-Jun-2013 09:10:37.359009] DEBUG: pid 6756, main(), line 1832: Sending "1" (OK) to parent via fd=5
[24-Jun-2013 09:10:37.389215] DEBUG: pid 6756, fpm_children_make(), line 421: [pool cyruserv] child 22288 started
[24-Jun-2013 09:10:37.391343] DEBUG: pid 6756, fpm_children_make(), line 421: [pool cyruserv] child 21911 started
[24-Jun-2013 09:10:37.391914] DEBUG: pid 6756, fpm_event_loop(), line 362: 5776 bytes have been reserved in SHM
[24-Jun-2013 09:10:37.391941] NOTICE: pid 6756, fpm_event_loop(), line 363: ready to handle connections
[24-Jun-2013 09:10:38.393048] DEBUG: pid 6756, fpm_pctl_perform_idle_server_maintenance(), line 379: [pool cyruserv] currently 0 active children, 2 spare children, 2 running children. Spawning rate 1
[24-Jun-2013 09:10:39.403032] DEBUG: pid 6756, fpm_pctl_perform_idle_server_maintenance(), line 379: [pool cyruserv] currently 0 active children, 2 spare children, 2 running children. Spawning rate 1
[24-Jun-2013 09:10:40.413070] DEBUG: pid 6756, fpm_pctl_perform_idle_server_maintenance(), line 379: [pool cyruserv] currently 0 active children, 2 spare children, 2 running children. Spawning rate 1
I don't know why this has started happening, but the logs are not telling me anything. Please ask for more information than this, you'll probably need it.