在我的网站中,我只有两个页面“index.php”和“page.php”,无论我输入什么,我都会被重定向到 localhost,例如,如果我转到 localhost/randompage 而不是被重定向到 404.html,我会转到 localhost (即index.php)
这是我的conf:
server {
listen 80;
server_name localhost;
root html;
index index.php;
location / {
if ($request_uri !~* '\/|page\.php\?.*') {
return 404;
}
try_files $uri $uri/ /index.php;
}
error_page 404 /404.html;
location = /404.html {
root html;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
我应该改变什么?