PHP-FPM is running, NGINX is running. NGINX does read the socket for PHP-FPM. I stopped PHP-FPM and I got bad gateway error. However, nothing gets displayed. I have checked nginx/error.log and php5-fpm.log and there is no error regarding that.
I changed logging in PHP-FPM to see what is happening and based on requests it creates child processes as needed (pm=ondemand).
Here is my php-fpm.conf:
pid = /var/run/php5-fpm.pid
error_log = /var/log/php5-fpm.log
log_level = debug
include=/etc/php5/fpm/pool.d/*.conf
pool.d/www.conf (the only file there)
[www]
user=www-data
group=www-data
listen=/var/run/php5-fpm.sock
listen.owner=www-data
listen.group=www-data
pm=ondemand
pm.max_children=4
pm.start_servers=2
pm.min_spare_servers=1
pm.max_spare_servers=3
chdir=/
and here is nginx.conf
user www-data www-data;
worker_processes 4;
pid /run/nginx.pid;
events {
worker_connections 768;
}
http {
client_max_body_size 32M;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
include /etc/nginx/mime.types;
default_type application/octet-stream;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
gzip on;
gzip_disable "msie6";
upstream php {
server unix:/var/run/php5-fpm.sock;
}
include /etc/nginx/sites-enabled/*;
}
If there was an error in somewhere, I would have tried to do something but here, I don't even know why this is not working. The only thing I tried was to restart both servers and that didn't help.
EDIT: Here is a single virtual server that this doesn't work with
server {
listen 80;
server_name example.com www.example.com;
index index.php;
root /var/www/example.com;
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
}
Directory and file permissions inside /var/www/example.com are root:www-data rwxr-xr-x
Also forgot to mention:
NGINX Version: 1.8.0
PHP version: 5.6.11-1~dotdeb+7.1 w/ Zeng Opcache v7.0.6-dev
Best Answer
I found the problem and solved it:
This is the line that was missing from virtual server config. I just added it into fastcgi_params file (my guess is, it was removed from that file during update)