Create the necessary folders and file structure if not already present.
# mkdir -p /data/nginx/custom # mkdir -p /data/nginx/error_pages # touch /data/nginx/custom/server_proxy.conf
Edit the server_proxy.conf
file placed in the /data/nginx/custom
folder. You can use a text editor like nano or vi.
# nano /data/nginx/custom/server_proxy.conf
Add the following configuration to server_proxy.conf:
# valeur par défaut, elle peut etre modifiées dans le "tab" advanced de chaque host. set $error_theme matrix; error_page 400 /error_pages/$error_theme/400.html; error_page 401 /error_pages/$error_theme/401.html; error_page 402 /error_pages/$error_theme/401.html; error_page 403 /error_pages/$error_theme/403.html; error_page 404 /error_pages/$error_theme/404.html; error_page 405 /error_pages/$error_theme/405.html; error_page 407 /error_pages/$error_theme/407.html; error_page 408 /error_pages/$error_theme/408.html; error_page 409 /error_pages/$error_theme/409.html; error_page 410 /error_pages/$error_theme/410.html; error_page 411 /error_pages/$error_theme/411.html; error_page 412 /error_pages/$error_theme/412.html; error_page 413 /error_pages/$error_theme/413.html; error_page 416 /error_pages/$error_theme/416.html; error_page 418 /error_pages/$error_theme/418.html; error_page 429 /error_pages/$error_theme/429.html; error_page 500 /error_pages/$error_theme/500.html; error_page 501 /error_pages/$error_theme/501.html; error_page 502 /error_pages/$error_theme/502.html; error_page 503 /error_pages/$error_theme/503.html; error_page 504 /error_pages/$error_theme/504.html; error_page 505 /error_pages/$error_theme/505.html; proxy_intercept_errors on; location ^~ /error_pages/ { alias /data/nginx/error_pages/; internal; }
Create your custom error HTML pages and save/copy them to the /data/nginx/error_pages/
folder. For example, create your 404.html
or 503.html
pages.
If you don't have the ability to create your own HTML files, you can find pre-made ones on GitHub, like those available at TheSL18/errorpages.
After completing the configuration, restart your Nginx Proxy Manager container to apply the changes.
Test if the new globally set error pages are working by intentionally triggering errors (e.g., accessing a non-existing page) and checking if the custom error pages are displayed.
This setup allows you to have globally configured custom error pages for a more user-friendly and informative experience. Customize the HTML pages according to your preferences or use existing ones from repositories like TheSL18/errorpages.