Legacy Knowledge Base
Published Sep. 10, 2025

How to setup custom error page in Nginx webserver

Written By

Santhosh Kumar

How To articles are not official guidelines or officially supported documentation. They are community-contributed content and may not always reflect the latest updates to Liferay DXP. We welcome your feedback to improve How To articles!

While we make every effort to ensure this Knowledge Base is accurate, it may not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with any feedback or concerns.

Legacy Article

You are viewing an article from our legacy "FastTrack" publication program, made available for informational purposes. Articles in this program were published without a requirement for independent editing or verification and are provided"as is" without guarantee.

Before using any information from this article, independently verify its suitability for your situation and project.

Issue

NOTE: Liferay Support does not recommend or endorse specific third-party products over others. The information provided about products not created by Liferay is for reference purposes only, and any implementation of these principles will be at your team's discretion.

  • The following article highlights some of the steps that can be carried out to configure a custom page at the webserver level.

Environment

  • Liferay DXP [all versions]
  • Web Server: Nginx

Resolution

Create three files in any of the Nginx installation servers, e.g., the following are created at the location below.

nginx_files.png

Notes:

  • Nginx can intercept the HTTP errors and serve a static page:
  • To enable this feature, add the proxy_intercept_errors on; flag to the webserver config file.
  • After that, remap each error with their HTML page and their PATH.
  • As an example, this configuration redirects the HTTP 404, 403, and 502 custom error pages.

Add the configuration below where Liferay with Nginx has been configured. For example, the following has been modified in the default file of Nginx itself:

location / { proxy_pass http://192.168.52.29:8080; proxy_set_header Host $http_host; proxy_intercept_errors on;

error_page 404 /404.html; error_page 403 /403.html; error_page 502 /502.html;

location = /404.html { root /usr/share/nginx/html; internal; }
location = /403.html { root /usr/share/nginx/html; internal; }

location = /502.html { root /usr/share/nginx/html; internal; } }

 

Additional Information

  • Please reach out to the Global Services Team if more assistance is required from the Liferay side, as third-party configurations come under their scope of work. 
Did this article resolve your issue ?

Legacy Knowledge Base