top of page

Disable a Site in Liferay and Display a Static Page Through Nginx

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

  1. Login to the Liferay application using admin credentials

  2. Navigate to: Control Panel → Sites

    Liferay Control Panel
  3. Find the target site in the list

  4. Click on the three-dot menu next to the site

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

  1. SSH into your web server

  2. Navigate to your Nginx config directory (one of the following):

cd /etc/nginx/sites-enabled
# or
cd /etc/nginx/conf.d
  1. Open the site’s config file:

sudo nano disabledsite.conf
  1. Comment out or remove the line that proxies traffic to the app server:

# proxy_pass http://localhost:8080;
  1. Add this directive inside the location block to redirect all non-existing URLs:

location / {
    if (!-e $request_uri) {
        rewrite ^ / permanent;
    }
}
Domain Configuration

This ensures that Nginx won’t pass requests to Liferay and instead reroutes them cleanly.


Step 3: Display a Custom Static HTML Page

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

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

Final 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


bottom of page