首先要進入到網頁目錄下
cd /usr/local/nginx/html/
將准備好的錯誤界面的圖片上傳
rz -E
編寫一個錯誤界面的網頁文件
vim 40x.html
在里面寫入:
<img src="error.jpg" />
接下來要編輯主配置文件
vim /usr/local/nginx/conf/nginx.conf
添加內容:
error_page 401 403 404 408 /40x.html;
location = /40x.html {
root html;
}
重新加載配置項:
killall -HUP nginx
進入網頁進行測試即可