Eu tenho um problema estranho com o 502 php5-fpm e nginx.
Configuração do Nginx vhost:
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 tem configuração padrão, eu adicionei poucas linhas de depuração:
[www]
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 é de propriedade de www-data, os arquivos são 660. O arquivo de soquete /var/run/php5-fpm.sock existe. Não há nada de interessante em /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
Mas há muitos erros de repetição no log do nginx:
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: 44.33.22.11, server: _, request: "GET /favicon.ico HTTP/1.1", host: "11.22.33.44:7777", referrer: "http://11.22.33.44:7777/index.html"
E /var/log/php5-fpm/access.log está vazio.
index.php é um simples arquivo de teste phpinfo () de uma linha.
O que há de errado com o php-fpm?