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.
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.