0

I recently upgraded to php 5.3 tor the purpose of using php-fpm. All my sites are working except for the default one which is showimg a blank page. Defined in nginx.conf as follows. What is te problem with this configuration. Error log doesn't seem to be reporting anything.

user              nginx;
worker_processes  1;
error_log         /var/log/nginx/error.log;
pid               /var/run/nginx.pid;
events {
    worker_connections  2048;
}
http {
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;
    index  index.html index.htm index.php;
    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;

    keepalive_timeout  65;

    client_max_body_size 4M;

    server {
        listen       80;
        server_name  mysite.net.au 111.118.171.66;
        root /usr/share/nginx/html;

        location ~* ^.+\.(xml|jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js|swf)$
        {
                rewrite ^/files(/.*)$ /wp-content/blogs.php?file=$1 last;
                access_log off;
                expires max;
                break;
        }
        location / {
            if (!-e $request_filename) {
                rewrite ^.+/?(/wp-.*) $1 last;
                rewrite ^.+/?(/.*\.php)$ $1 last;
                rewrite ^(.+)$ /index.php?q=$1 last;
            }

        }

        error_page  404              /404.html;
        location = /404.html {
        }

       error_page   500 502 503 504  /50x.html;
        location = /50x.html {
        }


        location ~ \.php$ {
            #rewrite ^/.*(/wp-.*/.*.php)$ $1;
            fastcgi_pass   php;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            include        /etc/nginx/fastcgi_params;
            }
    }
server {
        server_name www.mysite.net.au;
        rewrite ^/(.*) http://mysite.net.au/$1 permanent;
    }

    include /etc/nginx/conf.d/*.conf;

}
3
  • So, what is working and what isn't? Your config is pretty basic wordpress config with some minor flaws, which should not affect anything.
    – DukeLion
    May 19, 2012 at 7:02
  • error.log for nginx, please. By the way, I think you should rename plugins folder of wordpress and try to check if it working without them. May 19, 2012 at 19:39
  • all sites with their own .conf file are working. The site defined in nginx.conf shows a blank page. There doesn't seem to be any errors. pastie.org/3942269 I figure it's a wordpress issue, but I'm not sure how to debug it.
    – Adripants
    May 20, 2012 at 23:56

1 Answer 1

1

Change your rewrite rules in the location / block to:

location / {
    try_files $uri $uri/ /index.php?$args;
}

And to address a security vulnerability add this to first line in your ~ .php block

try_files $uri =404;

You must log in to answer this question.

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