Custom methods for the 404 502 error page for Nginx
- 2020-05-06 12:13:32
- OfStack
First open nginx.conf, fastcgi_temp_file_write_size 128k; Let's add
fastcgi_intercept_errors on; Note, including;
no.
Then add
to the site you want to define
error_page 404 = /404.htm;
For example:
Remember that the 404 page is placed under the directory of the site...
Test configuration
/usr/local/nginx/sbin/nginx -t
Restart nginx
with no errors /etc/init.d/nginx restart
BTW, and other pages define
the same way
error_page 502 = /502.htm;
fastcgi_intercept_errors on; Note, including;
no.
Then add
to the site you want to define
error_page 404 = /404.htm;
For example:
server
{
listen 80;
server_name www.deepvps.com;
index index.html index.htm index.php;
error_page 404 = /404.htm;
include location.conf;
root /home/www/logs;
}
Remember that the 404 page is placed under the directory of the site...
Test configuration
/usr/local/nginx/sbin/nginx -t
Restart nginx
with no errors /etc/init.d/nginx restart
BTW, and other pages define
the same way
error_page 502 = /502.htm;