Disable a Site in Liferay and Display a Static Page Through Nginx
- HARSH SHAH
- Jul 28
- 2 min read
When managing enterprise websites using Liferay DXP behind an Nginx web server, you might occasionally need to temporarily disable one of the sites. Whether for deactivation, migration, or maintenance, you can do this cleanly by:
Disabling the site from the Liferay Admin Panel
Preventing access via Nginx
Displaying a custom static HTML page
Let’s walk through this process step by step.
Step 1: Disable the Site in Liferay
Login to the Liferay application using admin credentials
Navigate to: Control Panel → Sites

Find the target site in the list
Click on the three-dot menu next to the site
Click Deactivate
🔒 Deactivating the site ensures that the Liferay app stops rendering or serving that specific site internally.
Step 2: Modify Nginx to Block App Server Access
SSH into your web server
Navigate to your Nginx config directory (one of the following):
cd /etc/nginx/sites-enabled
# or
cd /etc/nginx/conf.dOpen the site’s config file:
sudo nano disabledsite.confComment out or remove the line that proxies traffic to the app server:
# proxy_pass http://localhost:8080;Add this directive inside the location block to redirect all non-existing URLs:
location / {
if (!-e $request_uri) {
rewrite ^ / permanent;
}
}
This ensures that Nginx won’t pass requests to Liferay and instead reroutes them cleanly.
Step 3: Display a Custom Static HTML Page
Find your Nginx default root directory (based on your OS/config):
/usr/share/nginx/html/ (default on CentOS/RHEL)
/var/www/html/ (default on Ubuntu/Debian)
Replace or edit the index.html file:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="robots" content="noindex">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Site Unavailable</title>
<style>
body { text-align: center; font-family: sans-serif; padding: 100px; }
h1 { font-size: 2.5em; color: #333; }
p { font-size: 1.2em; color: #666; }
</style>
</head>
<body>
<h1>Site Temporarily Unavailable</h1>
<p>This website is currently undergoing maintenance or has been deactivated.</p>
<p>Please check back soon or contact the admin team.</p>
</body>
</html>✅ Tip: Use robots noindex to avoid getting this page indexed by search engines.
Step 4: Restart Nginx
After saving changes, restart the Nginx server to apply the updated config:
sudo nginx -t # Check for syntax errors
sudo systemctl restart nginxFinal Checklist
Task | Done? |
Liferay site deactivated | ✔️ |
proxy_pass removed in Nginx | ✔️ |
Static HTML in place | ✔️ |
Nginx restarted successfully | ✔️ |
Summary
This is a safe and clean method to disable a Liferay-based website hosted via Nginx while maintaining user experience and adhering to SEO best practices.
Related Tips
Use curl -I http://yourdomain.com to confirm Nginx is serving the static page
Maintain branding and helpful links in your index.html page for better UX
Backup your original Nginx config before making changes




Comments