How to connect a domain to a JSP application

To connect a domain to a JSP application, you usually need to do two things: point the domain to the hosting account, and map that domain to the application endpoint used by your Java/Tomcat setup. In a managed hosting environment with Plesk and My App Server, this is typically done by combining DNS changes, hosting configuration, and Tomcat or Apache routing so that visitors see your domain instead of a technical server URL or temporary path.

If your JSP site runs inside a private Tomcat instance or a separate JVM, the process is straightforward once the domain is correctly assigned in the control panel. The exact steps depend on whether the application is deployed as a root web app, a WAR package, or under a subpath, but the goal is the same: make your public domain resolve to the correct web application.

What “connecting a domain” means for a JSP application

In JSP hosting, a domain connection usually has two layers:

  • DNS pointing — your domain’s A record or nameserver setup must send traffic to the hosting platform.
  • Application mapping — the web server or Tomcat instance must know which JSP application should answer for that domain.

For example, you may want:

  • www.example.com to open your JSP application
  • example.com to redirect to the same site
  • app.example.com to point to a separate Java application

In a Plesk-based hosting platform, this is often handled by adding the domain to the subscription, enabling the application server through My App Server, and then attaching the domain to the Tomcat context or document root used by the app.

Before you start

Make sure you have the following ready:

  • The domain is registered and under your control
  • You can edit DNS records or nameservers
  • Your JSP application is already deployed or ready to deploy
  • You know whether the app should run on the main domain, a subdomain, or a subpath
  • Your hosting account has access to My App Server or a similar Java hosting feature

If the application is not yet installed, it is usually best to set up the domain first, then deploy the application to avoid confusion with URLs, context paths, and SSL certificates later.

Step 1: Point the domain to the hosting account

Option A: Update the domain’s nameservers

If your hosting provider manages DNS, you can set the domain to use the platform’s nameservers. This is a common choice when you want the hosting team or control panel to manage DNS records for you.

After changing nameservers, wait for propagation. Depending on the registrar and TTL values, this can take from a few minutes to up to 24 hours, sometimes longer.

Option B: Keep external DNS and change the A record

If you prefer to manage DNS elsewhere, update the domain’s A record to point to the hosting server IP address. For IPv6 setups, add an AAAA record if needed.

Typical DNS records:

  • example.com → A record to hosting IP
  • www.example.com → CNAME to example.com or A record to the same IP
  • app.example.com → A record or CNAME to the hosting target

After DNS changes, test the domain with a browser or a DNS lookup tool. If the domain still resolves to the old location, the change may still be propagating.

Step 2: Add the domain in Plesk or your control panel

Once DNS is pointing to the hosting account, add the domain to the subscription or web hosting space in the control panel. In Plesk, this is typically done from the domain management area.

At this stage, you define:

  • The primary domain name
  • Whether www should be included
  • The document root or web root used by the site
  • Whether the domain should have its own SSL certificate

For JSP hosting, the domain may not serve static files directly from a classic HTML directory. Instead, the domain often acts as the public hostname that routes traffic to Tomcat through Apache or through the My App Server integration.

Step 3: Install or select the JSP/Tomcat application server

In the My App Server environment, your JSP application typically runs on a private Tomcat instance or a private JVM. You may have a choice of ready-made Java/Tomcat versions that can be installed with a button, or you may upload and configure a custom version manually.

Choose the version that matches your application requirements. Older JSP applications may depend on a specific Java or Tomcat version, while newer apps may run better on a newer release.

Useful checks at this point:

  • Java version compatibility
  • Tomcat version compatibility
  • Required servlet/JSP specifications
  • Memory and process limits for the account

If you are not sure which version to use, check the deployment notes of your application or the build configuration of your WAR package.

Step 4: Deploy the application to the correct context

A JSP application becomes publicly available only when it is deployed to the right context path. This can be the root of the domain or a subpath under it.

Deploying to the root domain

If you want example.com to open the application directly, deploy the app as the root application. In many Tomcat setups, this means the application is mapped to / or to the domain’s main web root through Apache and Tomcat routing.

This is the best choice for a public website where you do not want extra path names in the URL.

Deploying to a subpath

If the application should open at something like example.com/shop or example.com/app, deploy it under the correct context path.

This approach is useful if:

  • One domain hosts multiple web apps
  • You want to keep a legacy app under a known path
  • You are separating a main site from a JSP module

Deploying to a subdomain

For a separate app like app.example.com, assign the subdomain in DNS and then connect it to its own application context. This is often cleaner than using a path when the app is independent from the main website.

Step 5: Configure Apache or Tomcat routing

Depending on the hosting platform, the domain may be served by Apache in front of Tomcat, or routed directly through the application server integration. In a managed Plesk environment, Apache is often used as the front-facing web server, while Tomcat serves the JSP content behind it.

What matters is that the public domain must point to the correct internal target. Common routing patterns include:

  • Apache proxying requests to Tomcat
  • A virtual host mapping domain name to application context
  • A dedicated connector between Apache and the Java service

If your application is not showing up on the domain, the issue is often a mismatch between the virtual host, the context path, and the deployed application name.

Common routing mistakes

  • The domain is added in DNS but not assigned in Plesk
  • The domain points to the server, but the app is deployed under a different context path
  • www and non-www versions are not aligned
  • Apache is serving a default page instead of forwarding to Tomcat
  • The app server is not running after deployment

Step 6: Set up the preferred public URL

Decide which URL should be canonical. In most hosting setups, one of these patterns is best practice:

  • https://example.com as the main address
  • https://www.example.com redirected to the non-www version
  • https://app.example.com for a separate application

Make sure only one version is treated as the primary public URL to avoid duplicate content and mixed links. If needed, set up redirects in the control panel or Apache configuration so both domain variants resolve consistently.

Step 7: Enable HTTPS for the domain

Modern JSP applications should run over HTTPS. After connecting the domain, install or assign an SSL certificate for the hostname you want to use publicly.

Usually you need to include:

  • The root domain
  • The www version, if used
  • Any subdomain used by the application

If the application is moved from a temporary URL to a real domain, update any hardcoded URLs, external callback addresses, and application settings so they use the secure domain name.

After enabling SSL, test:

  • Browser padlock status
  • Redirect from HTTP to HTTPS
  • No mixed-content warnings

How to connect a domain to a JSP application in My App Server

In an environment like My App Server, the practical workflow is usually:

  1. Add or point the domain to the hosting account
  2. Open the Java hosting section in Plesk
  3. Install or choose the Tomcat/Java version needed by the application
  4. Deploy the WAR or application package
  5. Map the domain or subdomain to the app context
  6. Check service status and start the app server if needed
  7. Attach SSL and test the public URL

This approach works well for small and medium JSP projects that need a private JVM, simple service control, and a manageable deployment process without maintaining a full enterprise Java stack.

Example: connect example.com to a JSP app

Suppose your JSP application is deployed in Tomcat and should open from example.com.

A typical setup would be:

  • DNS A record points example.com to the hosting server IP
  • www.example.com is a CNAME to example.com
  • The domain is added in Plesk
  • The app is deployed as the root context
  • Apache forwards requests to Tomcat or My App Server
  • SSL is enabled for both hostnames

Once this is done, a visitor typing https://example.com should land on your JSP application without seeing a server-specific URL or a Tomcat path.

Example: connect app.example.com to a separate JSP service

If the JSP application is separate from the main website, using a subdomain is often cleaner.

Setup example:

  • Create app.example.com in DNS
  • Point it to the hosting account IP or a suitable CNAME
  • Add the subdomain in Plesk
  • Deploy the JSP app under that subdomain’s web root or context
  • Assign a certificate for app.example.com

This is a good pattern for internal portals, client dashboards, small admin tools, and Java web apps that should remain separate from the main corporate site.

Troubleshooting domain connection problems

The domain still shows the old site

This usually means DNS is still propagating or the domain is cached locally. Check the A record, wait for propagation, and clear browser or DNS cache if needed.

Tomcat responds, but the wrong application opens

This suggests a context-path mismatch. Verify that the application is deployed to the correct path and that the domain is mapped to the intended Tomcat context.

Apache shows a default page instead of the JSP site

The domain may not be linked to the Java service correctly. Recheck the virtual host configuration and ensure the application server is selected as the target for that hostname.

HTTPS works on one hostname but not another

The SSL certificate may not cover both the root domain and the www or subdomain variant. Reissue or reassign the certificate with the correct names included.

The app server is running but the site returns an error

Look at application logs, Tomcat logs, and service status in the control panel. Common causes include deployment errors, Java version mismatch, memory limits, or invalid web.xml and JSP configuration.

Best practices for JSP domain mapping

  • Use a single canonical domain for the public site
  • Redirect all alternate hostnames to the preferred URL
  • Keep DNS and hosting configuration aligned
  • Match the Java and Tomcat version to the application requirement
  • Use HTTPS from the start
  • Test both the root domain and any subdomains after deployment
  • Review service status after each change in My App Server

These practices reduce downtime and make future maintenance easier, especially when you later update the application or move it to a new context path.

FAQ

Do I need to change both DNS and hosting settings?

Usually yes. DNS makes the domain reach the server, and the hosting or control panel maps that domain to the correct JSP application.

Can I connect a domain to a JSP app running on Tomcat?

Yes. This is the normal way to publish a JSP application. The domain is mapped to the Tomcat-hosted app through Apache, a virtual host, or the hosting platform’s Java integration.

Can I use a subdomain instead of the main domain?

Yes. A subdomain such as app.example.com is often the best choice for a separate JSP application or admin panel.

How long does DNS propagation take?

It depends on TTL values and registrar caching. In many cases it is visible within a short time, but full propagation can take up to 24 hours or longer.

Why does my domain open a default page instead of my JSP app?

This usually means the domain is pointing to the hosting account, but the application is not mapped to that hostname or context path correctly.

Can I use the same domain for multiple Java applications?

Yes, but they should be separated by subdomains or subpaths and configured carefully to avoid routing conflicts.

Do I need a dedicated enterprise Java server for a small JSP project?

Not usually. For small and medium applications, a private Tomcat or private JVM inside a managed hosting account is often enough, especially when you need simple deployment and control panel management.

Conclusion

Connecting a domain to a JSP application is mostly a matter of aligning DNS, hosting configuration, and application routing. In a Plesk-based Java hosting environment with My App Server, this usually means pointing the domain to the account, deploying the application to the correct Tomcat context, and enabling HTTPS for the public hostname.

When everything is set correctly, your visitors can access the JSP site through a clean domain such as example.com or app.example.com, while you keep the practical benefits of private Java hosting, controlled deployment, and service management from the control panel.

  • 0 Users Found This Useful
Was this answer helpful?