I have a weird 502 problem with php5-fpm and nginx. Nginx vhost config:

server {
    server_name _;
    listen 7777 default_server;
#        root /var/www/html;
    root /var/www/test_app;
#        index index.php;
    index index.php index.html index.htm;

            location / {
              try_files $uri /index.html;

#   location / {
#                try_files $uri $uri/ =404;
#        }

    location ~ \.php$ {
    try_files $uri =404;
    include fastcgi_params;
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_intercept_errors on;
    fastcgi_ignore_client_abort on;
    fastcgi_connect_timeout 60;
    fastcgi_send_timeout 180;
    fastcgi_read_timeout 180;
    fastcgi_buffer_size 128k;
    fastcgi_buffers 256 16k;
    fastcgi_busy_buffers_size 256k;
    fastcgi_temp_file_write_size 256k;
    fastcgi_max_temp_file_size 0;
    fastcgi_pass unix:/var/run/php5-fpm.sock;



php5-fpm has default config, I have only added few debug lines:

access.log = /var/log/php5-fpm/access.log
access.format = "%t \"%m %r%Q%q\" %s %{mili}dms %{kilo}Mkb %C%%"
catch_workers_output = yes
php_flag[display_errors] = on
php_admin_flag[log_errors] = true

/var/www/ direcory is owned by www-data, files are 660. Socket file /var/run/php5-fpm.sock exists. There is nothing interesting in /var/log/php5-fpm/error.log:

[01-Jan-2018 20:29:44] NOTICE: fpm is running, pid 14336
[01-Jan-2018 20:29:44] NOTICE: ready to handle connections
[01-Jan-2018 20:29:44] NOTICE: systemd monitor interval set to 10000ms
[01-Jan-2018 20:50:40] NOTICE: Terminating ...
[01-Jan-2018 20:50:40] NOTICE: exiting, bye-bye!
[01-Jan-2018 20:50:41] NOTICE: configuration file /etc/php5/fpm/php-fpm.conf te$

[01-Jan-2018 20:50:41] NOTICE: fpm is running, pid 14463
[01-Jan-2018 20:50:41] NOTICE: ready to handle connections
[01-Jan-2018 20:50:41] NOTICE: systemd monitor interval set to 10000ms

But there are bunch of repeating errors in nginx log:

sudo grep error /var/log/nginx/error.log
2018/01/01 20:50:43 [error] 14453#0: *4 rewrite or internal redirection cycle while internally redirecting to "/index.html", client:, server: _, request: "GET /favicon.ico HTTP/1.1", host: "", referrer: ""

And /var/log/php5-fpm/access.log is empty. index.php is a simple one-line phpinfo() test file. What's wrong with php-fpm?

1 Answer 1


OK, so answering myself, I found the error - when I installed php5-fpm there was an old config file with wrong path to unix socket. After fixing that line in /etc/php/fpm/pool.d/www.conf file into:


I was able to see the phpinfo page.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .