Mar 22, 2012

nginx php-fpm empty site


I am writing this as I was stuck trying to fix it whole night.

We have recently migrated to a new server. Before migration we have been running our site on nginx + cgi (script). After migration we decided to try apache + mod_php. It was rather terrible, and I would like to migrate back to nginx, but this time I want it with php-fpm (as people say its a cool)

So I did follow a number of guides and I think i done everything correctly.
As well as that I have our old config files for “server” section, which i reviewed and places into new config.

So I ended up having an empty site when I enter our URL. (By empty I mean blank page, no letter, errors or anything at all.) In the access log there are some weird errors like: – – [22/Mar/2012:06:08:11 +0200] “-” 400 0 “-” “-“

My guess is that php-fpm is not working, but not sure how to confirm it.

Maybe some1 could give some help ? Would much appreciate.

my nginx config:

user              nginx;
worker_processes        12;error_log  /var/log/nginx/error.log;
#error_log  /var/log/nginx/error.log  notice;
#error_log  /var/log/nginx/error.log  info;pid        /var/run/;
events {
worker_connections 4096;
http {
include       /etc/nginx/mime.types;
#default_type  application/octet-stream;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;sendfile        on;
#tcp_nopush     on;#keepalive_timeout  0;
keepalive_timeout  65;
tcp_nodelay        on;gzip  on;
    gzip_disable "MSIE [1-6]\.(?!.*SV1)";fastcgi_buffer_size 256k;
fastcgi_buffers 4 256k;
server {
    listen 80;
    access_log /var/log/nginx/example.access.log;
    error_log /var/log/nginx/error.log;
    root /home/www/example;
    index index.php;
    client_max_body_size 50M;
    #error_page 404 /404.html;    # phpMyAdmin
    location /phpmyadmin {
        root /usr/share/;
        error_log /var/log/nginx/phpmyadmin.log;
        try_files $uri $uri/ /index.php;
    location ~ ^/phpmyadmin/.*\.php$ {
        root /usr/share/;
        error_log /var/log/nginx/phpmyadmin.log;
        include /etc/nginx/fastcgi_params;
    }    # Munin
    location /monitoring {
        root /var/www/;
        auth_basic "Restricted";
        auth_basic_user_file /etc/nginx/conf.d/monitoring_users;
        error_log /var/log/nginx/monitoring.log;
        index index.html;
    }    # The site
    location / {
        try_files $uri $uri/ /index.php/?$uri&$args;
    }    # PHP interpreter
    location ~ \.php {
        include /etc/nginx/fastcgi_params;
Asked by Katafalkas


You should check error.log not access.log if there are any errors.

unless you already have that in your fastcgi_params you should add:

fastcgi_param  SCRIPT_FILENAME    $document_root$fastcgi_script_name;

i.e. your php section should look like:

# PHP interpreter
location ~ \.php$ {
    include /etc/nginx/fastcgi_params;
    fastcgi_param  SCRIPT_FILENAME    $document_root$fastcgi_script_name;
Answered by hidden_4003

Related posts:

  1. Blank Page: wordpress on nginx+php-fpm
  2. Nginx doesn’t send _SERVER[“DOCUMENT_ROOT”] to PHP-fpm
  3. php pages in a nginx + php-fpm server doesn’t load
  4. nginx + PHP-FPM = “permission denied” error 13 in nginx log; configuration mistake?
  5. php5-fpm + nginx + drupal7 : keeps sending me index.php for download

Leave a comment