如果您直接输入我的404页面https://epicmc.us/404.php加载完全正常,但是当您在浏览https://epicmc.us/thispagedoesntexist这样的页面时遇到404错误(不存在)时,它只是有点刷新页面..几乎就像我在https://epicmc.us/#
中输入一样这是我的配置。
server {
listen 80;
listen 443;
default_type text/html;
location / {
root /usr/share/nginx/html;
index index.php index.html index.htm;
try_files $uri $uri/ /index.php;
}
root /usr/share/nginx/html;
index index.php index.html index.htm;
server_name epicmc.us;
error_page 404 /usr/share/nginx/html/404.php;
error_page 500 502 503 504 /50x.php;
location = /50x.html {
root /usr/share/nginx/html;
}
# pass the PHP scripts to FastCGI server listening on the php-fpm socket
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}