1

I'm migrating from Apache to Nginx. Everything works great, except if I have the Redirection plugin enabled. In this case, I can't access any of the pages on my site with the exception of the home page. They all return a 404 error. If I disable the plugin again, I'm able to navigate my site normally.

My Nginx config is as follows:

upstream php 
{
    server 127.0.0.1:9000;
}

    server
    {
        listen  80; 
        root    /home/clearpointccs/public;
        server_name www.clearpointcreditcounselingsolutions.org clearpointcreditcounselingsolutions.org;
        index    index.php;

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


        location ~\.php$
        {   
            include             /etc/nginx/fastcgi_params;
            fastcgi_param       SCRIPT_FILENAME     $document_root$fastcgi_script_name;
            fastcgi_pass        php; 
            fastcgi_index       index.php;
        }   
    }

I've tried to look into this, but everything else I read says the plugin is compatible with Nginx, which makes me believe it's something in my config. Any ideas?

EDIT: A peek at the error logs shows the following:

 14 2012/06/29 21:36:48 [error] 17279#0: *703 FastCGI sent in stderr: "ould not be called statically, assuming $this from incompatible context in /home/clearpointccs/public/wp-content/plugins/re    direction/models/match.php on line 68
 15 PHP Strict Standards:  Non-static method Red_Action::create() should not be called statically, assuming $this from incompatible context in /home/clearpointccs/public/wp-content/plugins/redir    ection/models/redirect.php on line 46
 16 PHP Strict Standards:  Non-static method Red_Action::available() should not be called statically, assuming $this from incompatible context in /home/clearpointccs/public/wp-content/plugins/re    direction/models/action.php on line 20" while reading response header from upstream, client: 96.228.60.10, server: www.clearpointcreditcounselingsolutions.org, request: "GET /about-us/ HTTP/    1.1", upstream: "fastcgi://127.0.0.1:9000", host: "www.clearpointcreditcounselingsolutions.org", referrer: "http://www.clearpointcreditcounselingsolutions.org/"
1
  • Okay, you get 404 errors. But, what did the Nginx error-log say about these 404 error? Any clues? Jun 29, 2012 at 15:57

1 Answer 1

1

I notice a couple of things right off the bat.

First, the try_files parameter in your root location block should be:

try_files $uri $uri/ /index.php?$args;

Also, I have this block in my own conf file (using Nginx and Redirection together just fine) but you seem to be missing it:

location @wp {
    rewrite ^/files(.*) /wp-includes/ms-files.php?file=$1 last;

    rewrite ^(/[^/]+)?(/wp-.*) $2 last;
    rewrite ^(/[^/]+)?(/.*.php) $2 last;

    rewrite ^/(.*)$ /index.php?q=$1 last;
}

The first rewrite there is for multisite, so you may or may not need it ...

1
  • Still no joy. I did take the commenter's suggestion and peek in the error log. There's definitely something happening with the plugin. Jun 29, 2012 at 21:29

Not the answer you're looking for? Browse other questions tagged or ask your own question.