nginx phpmyadmin 404

nginx phpmyadmin 404

私は nginx ウェブサーバーに phpmyadmin をインストールしようとしています。問題なく phpmyadmin をインストールしました。サブドメインを作成しました。セキュリティ上の理由から、サブドメインを「phpmyadmin」とは呼ばず、別の名前を使用しました。次に、サブドメインにこの設定を使用しました。

server {
    listen   80;
    server_name myphpmyadminsubdomain.domain.com;
    access_log off;
    error_log /srv/www/myphpmyadminsubdomain/error.log;

    location / {
                root   /usr/share/phpmyadmin;
                index  index.php;
                }

location ~ \.php$ {
    try_files $uri =404;

    fastcgi_split_path_info ^(.+\.php)(/.+)$;

    include fastcgi_params;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
#   fastcgi_intercept_errors on;
    fastcgi_pass php;
}

location = /favicon.ico {
    log_not_found off;
    access_log off;
}

location = /robots.txt {
    allow all;
    log_not_found off;
    access_log off;
}

location ~ /\. {
    deny all;
    access_log off;
    log_not_found off;
}
      }

次に、次のように有効にします。

/etc/nginx/sites-available/myphpmyadminsubdomain /etc/nginx/sites-enabled/myphpmyadminsubdomain

nginx を再起動して、myphpmyadminsubdomain.domain.com にアクセスすると、nginx 404 Not Found エラーが表示されます。

何が間違っているのでしょうか?

答え1

これが私の設定です

server {
    listen 80; ## listen for ipv4
    server_name pma.example.com;
    access_log /var/log/nginx/pma.access.log;
    error_log       /var/log/nginx/pma.error.log;
    root /server/phpmyadmin/phpMyAdmin-3.4.2-all-languages;

    location / {
            index index.php index.html;
    }

    location ~ \.php$ {
            fastcgi_split_path_info ^(.+\.php)(/.+)$;
            include /etc/nginx/fastcgi_params;
            fastcgi_intercept_errors off;
            fastcgi_pass php;
    }

}

ルートを に変更し/usr/share/phpmyadmin、 をfastcgi_params適切に変更する必要があります。

答え2

これは通常パスの問題です。nginx.confで設定します

fastcgi_param SCRIPT_FILENAME /absolute/path/to/server/root$fastcgi_script_name;

パスの最後の dir の後にスラッシュがないことに注意してください。次に、fastcgi_pass をソケットまたはローカル URL のいずれかに渡します。

php-cgi を chroot していますか? その場合、すべてのパスはその chroot に対して相対的である必要があります。

関連情報