是Nginx在VPS上搭建的Hexo博客,配置404页面的时候才发现。
localhost:4000/404.html
是可以正常显示的。
但是比如我输入 localhost:4000/asdasdasd
这样一个不存在的页面
他就会显示 Cannot GET /asdasdasd/
不太懂是哪里的问题,能不能把Cannot GET换成404?
伊谢尔伦2017-04-17 15:33:10
There is no relevant routing set in the nginx configuration file.
You can read this post, the general idea is how to route all 404 errors to a custom page.
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
. . .
error_page 404 /custom_404.html;
location = /custom_404.html {
root /usr/share/nginx/html;
internal;
}
}
PHP中文网2017-04-17 15:33:10
Just set the public directory generated by hexo g to the root directory of the website. The performance of hexo s is too low.