URL nginx return に既知のファイル拡張子を入れるたびに404 Not Found
.
domain.com/myroute.foo
anddomain.com/foo/myroute.foo
は問題ありませんが、domain.com/myroute.php
and domain.com/foo/myroute.php
(または .css、.js など) は を返します404 Not Found
。
私のnginxサーバー構成:
server {
listen 80;
server_name domain.com;
root /var/www/path/public;
charset utf-8;
gzip on;
#access_log logs/host.access.log main;
location / {
index index.html index.php index.htm;
try_files $uri $uri/ /index.php?q=$uri&$args;
}
location ~ \.php$ {
try_files $uri = 404;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $request_filename;
include fastcgi_params;
}
location ~* \.(jpg|jpeg|gif|png|bmp|ico|pdf|flv|swf|exe|html|htm|txt|css|js) {
add_header Cache-Control public;
add_header Cache-Control must-revalidate;
expires 7d;
access_log off;
}
}
既知のファイル拡張子 ( /myroute.php
) を持つ URL が、index.php
他の URL のように自分のファイルに移動しないのはなぜですか?