3

php5-fpmでnginxを起動して実行しようとして、頭を壁にぶつけています。見落としているのは細かいことだと感じたので、休憩を取り、数日後に戻ってきました。今夜、さらに数時間いじっていましたが、役に立ちませんでした。

とにかく、ここに問題があります:私はnginxを稼働させています。Web ページを適切に提供しているようです。たとえば、http://www.shidenadvanced.comのベース Web サイトは問題なく動作します。ただし、 http://www.shidenadvanced.com/test.phpにある私が持っている php テストは空白として戻ってきます。以前は、502 Bad Gateway として返されていました。

私の調査により、php-fpmを介して適切にルーティングできないことを意味することがわかりました。それについては100%ではありません。

これは私の /sites-available/config です:

server {
    server_name www.shidenadvanced.com shidenadvanced.com;
    access_log /srv/sites/shidenadvanced/logs/access.log;
    error_log /srv/sites/shidenadvanced/logs/error.log;

    root /srv/sites/shidenadvanced/www;
    index index.php index.html index.htm;

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

    #location ~ \.php$ {
    #    try_files $uri =404;
    #    include /etc/nginx/fastcgi_params;
    #    fastcgi_pass unix:/var/run/php-fpm5.sock;
    #    fastcgi_index index.php;
    #    fastcgi_param SCRIPT_FILENAME /srv/sites/shidenadvanced/www$fastcgi_script_name;
    #}

    location ~ \.php$ {
        try_files $uri =404;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php5-fpm.sock;
        fastcgi_index index.php;
        include fastcgi_params;
    }

    location ~ /\.ht {
        deny all;
    }
}

これ以外では、ほとんどの設定をそのままにしておきました。何が起こっているのか完全にはわかりません。誰でも光を当てることができますか?

4

2 に答える 2

2

これを試して。fastcgi の処理方法にいくつかの変更を加えました

server {
server_name www.shidenadvanced.com shidenadvanced.com;
access_log /srv/sites/shidenadvanced/logs/access.log;
error_log /srv/sites/shidenadvanced/logs/error.log;

root /srv/sites/shidenadvanced/www;
index index.php index.html index.htm;

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

# use fastcgi for all php files
location ~ \.php$
{
    fastcgi_pass 127.0.0.1:9000;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include fastcgi_params;
}

location ~ /\.ht {
    deny all;
}
}
于 2013-01-26T08:11:39.910 に答える