Ubuntu nginx 配置404錯誤頁面
Ubuntu18.04 nginx 當(dāng)然其他版本的也差不多
1.創(chuàng)建404頁面;
2.更改nginx.conf(我的安裝目錄是/etc/nginx/)在http定義區(qū)域加入:
fastcgi_intercept_errors on;
3.更改/etc/nginx/sites-enabled/default 文件;
server定義區(qū)域中添加:
error_page 404 /404.html;
? ? location = /404.html {
? ? ? ? root /var/www/html;
? ? }
記得把404頁面修改為你的404頁面的路徑
4.測試nginx.conf正確性:
nginx –t
測試成功頁面
5.重啟nginx:
service nginx restart
完畢流酬!