Running Multiple Custom Domains on GlassFish Server

| August 19, 2013

We have previously shared all of the benefits of having multiple custom domains for your Java and PHP web sites in these posts:

Today, we will show you how to run a few domain names on Java application server GlassFish, which combines enterprise-class capabilities with open source cost efficiency. It's an enterprise-ready application server with true interoperability and a wide range of features including superior documentation, administration, and configuration.

Let's see how to run multiple domains for your Java site on GlassFish server in just a few minutes!

1. Log into the Jelastic dashboard and click Create environment.

2. Select application server GlassFish and specify the cloudlet limits for it. Enter your environment name and click Create.

GlassFish Server Environment

3. In a matter of seconds you environment will be successfully created and appear on the dashboard.

Environment with Application Server GlassFish

4. Next, you will need to add a CNAME record or set an A Record. You can find more information on how to do this in our custom domains document

5. Bind your custom domains by clicking the Settings button for your environment and choosing the appropriate setting. We'll use and domains as examples.

Bind Custom Domains

Note: We've put entries into our hosts file for local testing so this will work only from our machine, which has those hosts' entries.

7. When you created the environment, Jelastic sent you the link and credentials to GlassFish DAS node. Log in using these credentials and navigate to the Applications tab in order to deploy your application.

GlassFish Server Application Deploy

8. Once your application is successfully deployed go to Configurations > default-config > Virtual Servers and click New... to create new virtual server.

GlassFish Custom Domains Config

9. Specify the ID of the new server, enter bounded to your environment custom domains separated by commas in the Hosts field, select the suitable http listener and then choose the required web module.

Virtual Server GlassFish
10. Save the changes and voilà! You will see that your application is available via the specified domain names.
GlassFish Server Custom Domains

It's very easy to manage your custom domains with Jelastic's rich set of tools. Enjoy! And don't forget to tell your friends about how awesome hosting in the Jelastic cloud is!