web-dev-qa-db-ja.com

Nginx +リダイレクトプラグインがパーマリンクを解除する

私はApacheからNginxに移行しています。 リダイレクトプラグイン が有効になっている場合を除いて、すべてがうまく機能します。この場合、ホームページ以外の私のサイトのどのページにもアクセスできません。それらはすべて404エラーを返します。プラグインを再度無効にすると、通常どおりサイトに移動できます。

私のNginxの設定は以下の通りです。

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;
        }   
    }

私はこれを調べようとしましたが、私が読んだ他のすべてのものはNginxと互換性があると言っています。何か案は?

編集:エラーログを覗くと、次のことがわかります。

 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
Tom Thorogood

コウモリからすぐにいくつかのことがわかります。

まず、ルートロケーションブロックのtry_filesパラメータは次のようになります。

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

また、私は自分自身のconfファイルにこのブロックを持っています(NginxとRedirectionを一緒に使っても問題ありません)が、欠けているようです:

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;
}

最初の書き換えはマルチサイト用なので、必要な場合もあれば必要ない場合もあります。

1
EAMann