NGINXとPHP7のURL書き換えの問題がFastCGIで有効になっています。.php拡張子を無効にしますが、.phpなしのファイルをPHPファイルとして実行します。
要件は次のとおりです。
オリジナルURL:http://example.com/somename1.php
応答:http://example.com/somename1
応答::http://example.comまたはhttp://example.com/
応答::それは実行されることがhttp://example.com/somename1.php
オリジナルURLが実行されますそれは404エラー
オリジナルURLがスローされますhttp://example.com/index.php
私はこれらのURLは上記の必要条件を満たしていません。
- How to remove both .php and .html extensions from url using NGINX?
- remove .php from url with rewrite rule
- remove .php extension from url in nginx
サンプル "デフォルト" ファイルの内容は以下のとおりです。
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/html;
index index.php index.html index.htm index.nginx-debian.html;
server_name _;
location/{
try_files $uri $uri/ =404;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
}
location ~ /\.ht {
deny all;
}
}
問題を手伝ったり、他のページで私が詳細を知ることができますか?
オリジナルURL:http://example.com/somename1.php応答:それは 404エラー
internal
ディレクティブを使用をスローします
おかげ
この回答は不完全であり、同じ問題が発生した方には役に立ちません。将来的にはうまくいかないかもしれないリンクに頼るのではなく、すべての部分の完全な答えをここに示してください。言い換えれば、サーバーブロックは動作しているときにどのように見えるのですか? – Tomas