是Nginx在VPS上搭建的Hexo博客,配置404页面的时候才发现。
localhost:4000/404.html 是可以正常显示的。
localhost:4000/404.html
但是比如我输入 localhost:4000/asdasdasd 这样一个不存在的页面他就会显示 Cannot GET /asdasdasd/
localhost:4000/asdasdasd
Cannot GET /asdasdasd/
不太懂是哪里的问题,能不能把Cannot GET换成404?
走同样的路,发现不同的人生
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; } }
Just set the public directory generated by hexo g to the root directory of the website. The performance of hexo s is too low.
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.
Just set the public directory generated by hexo g to the root directory of the website. The performance of hexo s is too low.