Liferay

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

In our case, multiple sites are hosted on a single app server and web server(Nginx). The requirement was to disable one of the sites, and a result of hitting the disabled site should be a custom page displayed with the message that the site is unavailable.

For doing this, there are three actions to be performed:

  • Disable the app from the app server
  • Avoid it from hitting the app server form the web server
  • Display a custom static HTML page instead of the default nginx page.

To disable the site:

Disable from Liferay (App Server)
  • Login to Liferay application using the admin credentials
  • Goto Control Panel => Sites
Goto-Control-Panel Control panel
  • Disable the required site by clicking on three dots located besides the site and then on Deactivate.
 Disable from nginx (Web Server)
  • Login to your web server and open the terminal
  • Go to the following path: /etc/nginx/sites-enabled  or  /etc/nginx/conf.d
  • Open the config file of the specific domain you need to disable.
  • Comment the line containing proxy_pass and add the following to disable all the URLs of that domain present in the location tag:
 if (!-e $request_uri) {
       	rewrite ^ / permanent;
 }
Disable from nginx


Display a static HTML page:

  • Put your custom HTML content in index.html (This file has the default page of nginx) file present at the following path: /usr/share/nginx/html/  or  /var/www/html (Based on your server config, the location of index.html file might be in any one of the location).
  • Restart the nginx server:  sudo service nginx restart

Conclusion:
In this tutorial, you learned how to disable a site from Liferay, where the default Nginx page is located, and how to change it by using any text editor

Liferay Enterprise Solutions

Liferay

How Liferay Enterprise Solutions Are Reshaping Industries

Discover how Liferay Enterprise Solutions are revolutionizing various industries with their versatile and innovative features. This blog explores the transformative impact of Liferay's solutions, showcasing how they are reshaping businesses and driving digital innovation across diverse sectors.

Liferay Digital Transformation

Liferay

How Liferay Makes Digital Transformation User-Friendly

Liferay Enterprise Solutions enable businesses to digitally transform in a streamlined manner. The flexible and customizable Liferay platform makes it easy for companies to build omnichannel customer experiences, employee portals, and other digital solutions.

Transform Your Business With Digital Enterprise Solutions

Contact us

Our Offices

INDIA AHMEDABAD, INDIA

401, One World West, Nr. Ambli T-Junction 200, S P Ring Road, Bopal, Ahmedabad, Gujarat 380058

UK
UK

Kemp House 160 City Road, London, United Kingdom EC1V 2NX

GERMANY GERMANY

Nürnberger Str. 46 90579 Langenzenn Deutschland

AUSTRALIA AUSTRALIA

Level 36 Riparian Plaza, 71 Eagle Street, Brisbane, QLD 4000

USA USA

4411 Suwanee Dam road, Bld. 300 Ste. 350 Suwanee GA, 30024

SOUTH AFRICA SOUTH AFRICA

Cube Work Space, 24 Hans Strijdom Avenue, Cape Town

UAE DUBAI, UAE

B 503 Sama Tower, Sheikh Zayed Road, United Arab Emirates