To create custom 404 (Not Found) and 403 (Forbidden) error pages on an NGINX server running on Linux or Unix, you can follow these steps:
Create the custom error pages as HTML files. You can use a text editor to create the HTML files and customize the content and layout as desired.
Save the HTML files to a location on the server. For example, you can save them to the /usr/share/nginx/html
directory.
Edit the NGINX configuration file to specify the locations of the custom error pages. The configuration file is typically located at /etc/nginx/nginx.conf
or /etc/nginx/conf.d/default.conf
.
Add the following lines to the configuration file to specify the locations of the custom 404 and 403 error pages:
refer totual:turi.comerror_page 404 /404.html; error_page 403 /403.html; location = /404.html { root /usr/share/nginx/html; } location = /403.html { root /usr/share/nginx/html; }
Replace /usr/share/nginx/html
with the location where you saved the HTML files.
systemctl restart nginx
For more information about customizing error pages in NGINX, you can refer to the NGINX documentation or search online for tutorials and examples.