Issue
-
Run multiple Sites on a single instance using the different domain names
-
Example: Site 1 running on the 'www.test.com:8080' domain and Site 2 running on the 'www.demo.com:8080' domain.
-
Environment
- Liferay DXP [all versions]
Resolution
- Modify the hostname, navigate to the "/etc/hosts" file, add the "www.test.com" and "www.demo.com" domain names with the 'localhost IP', and save it.
- After, adding the domain name to the host file, start the Liferay server.
- Navigate to the Control Panel-> System-> Virtual Instances and click on the '+' icon to create a new Virtual Instance, fill in all the fields, and save it.
- After the Virtual Instance is created, navigate to Control Panel-> Sites, create new sites with the name "Site1" and save it. The page redirects to the "Site Settings", navigate to Platform-> Site Configuration-> SITE SCOPE-> Site URL, and set the 'Virtual Host' to "www.test.com" and save it.
- For "Site2" follow the 4th point again, set the 'Virtual Host' to "www.demo.com" and save it.
- Now after all the changes are done, open the browser's new tab hit "www.test.com:8080" URL, and 'Site1' is opened. For "Site2" hit the "www.game.com:8080" URL, and "Site2" is open.