MyBB Internal: One or more warnings occured. Please contact your administrator for assistance.
WebPagetest Forums - viewlog.php errors w/nginx+php-fpm

WebPagetest Forums

Full Version: viewlog.php errors w/nginx+php-fpm
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Recently I took my WPT server from an Apache+mod_php setup to Nginx+php-fpm and I have been running into an issue with the viewlog.php getting processed correctly. Basically, on the Apache setup things work as expected. However, under my nginx+php-fpm setup I got a 404 error.

Things I have checked:

file permissions
making sure php-fpm runs under the right user/group
nginx setup
php-fpm setup

Its very frustrating because I cant seem to get to the root of WHY this is 404ing. I've tried turning on debug level logging in php-fpm and that didnt turn anything up. I am doing unix sockets instead of tcp sockets for the handoff to php-fpm, no idea if this makes a difference or not. Below are sanitized config files from nginx and php-fpm:

# Main Module

user nginx;
worker_processes 2;
error_log /var/log/nginx/error.log;
pid /var/run/;

# Events Module
events {
worker_connections 4096;
multi_accept on;
use epoll;

http {

# Basic Settings
include /etc/nginx/mime.types;
default_type application/octet-stream;
server_tokens off;

# Logging
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';

access_log /var/log/nginx/access.log main;

# Buffers & Timeouts
sendfile on;
tcp_nopush on;
tcp_nodelay on;

types_hash_max_size 2048;

send_timeout 2;

keepalive_timeout 10;
keepalive_requests 10000;
reset_timedout_connection on;

client_body_timeout 10;
client_body_buffer_size 128k;
client_header_timeout 30;

# File Cache Settings
open_file_cache max=5000 inactive=20s;
open_file_cache_valid 30s;
open_file_cache_min_uses 2;
open_file_cache_errors on;

# Gzip Settings
gzip on;
gzip_http_version 1.1;
gzip_vary on;
gzip_comp_level 6;
gzip_proxied any;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript text/x-js;
gzip_buffers 16 8k;
gzip_disable "MSIE [1-6]\.(?!.*SV1)";

# Virtual Host Configs
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;

site config
server {
listen 80;
server_name localhost;
root /opt/x/y;
index index.php;

location /install/ {
allow x.x.x.x;
allow y.y.y.y;
deny all;
location /settings/ {
allow x.x.x.x;
allow y.y.y.y;
deny all;
location /testlog.php {
allow x.x.x.x;
allow y.y.y.y;
deny all;
location /testlog/ {
allow x.x.x.x;
allow y.y.y.y;
deny all;
location /cli/ {
deny all;
location ~ ^/(status|healthcheck)$ {
allow x.x.x.x;
allow y.y.y.y;
deny all;
include fastcgi_params;
fastcgi_pass unix:/var/run/php55-fpm.sock;

# redirect server error pages to the static pages
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;

# Pass PHP-Files To Pool via UNIX Sockets
location ~ \.php?$ {
try_files $uri =404;
include fastcgi_params;
fastcgi_pass unix:/var/run/php55-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_intercept_errors on;
fastcgi_split_path_info ^(.+\.php)(.*)$;

#Buffer all the things
#Max response size = 252k
#Avg response size = 437b
fastcgi_buffers 1024 1k;
fastcgi_buffer_size 1k;
fastcgi_busy_buffers_size 1023k;
fastcgi_temp_file_write_size 512k;
fastcgi_read_timeout 120;

#Prevent version info leakage
fastcgi_hide_header X-Powered-By;

location ~ /\.ht {
deny all;


pid = /var/run/php-fpm/
error_log = /var/log/php-fpm/error.log
log_level = notice
daemonize = yes

; Pool Definitions ;
; See /etc/php-fpm.d/*.conf

www php-fpm pool conf
listen = /var/run/php55-fpm.sock
listen.allowed_clients =
listen.owner = nginx = nginx
listen.mode = 0660

user = nginx
group = nginx

pm = dynamic
pm.max_children = 50
pm.start_servers = 5
pm.min_spare_servers = 5
pm.max_spare_servers = 35
pm.max_requests = 4096
pm.status_path = /status
ping.path = /healthcheck
ping.response = pong
slowlog = /var/log/php-fpm/www-slow.log
rlimit_files = 1024
catch_workers_output = yes
php_flag[display_errors] = on
php_admin_value[error_log] = /var/log/php-fpm/www-error.log
php_admin_flag[log_errors] = on
php_value[session.save_handler] = files
php_value[session.save_path] = /var/lib/php/session
php_value[soap.wsdl_cache_dir] = /var/lib/php/wsdlcache

If anyone has a guess as to what I've screwed up I'm all ears, thanks!
As it turns out the way the PHP code for this page is written is wrong. It works on Apache because Apache is stupid and starts displaying the output before the PHP returns a 400 error. In Nginx this fails because it waits until it gets the HTTP response code of 400 and shows the actual error.
Reference URL's