Multiple Grails applications on a single Tomcat instance

Let us consider this scenario, you are now running a grails application on a Tomcat server. Now you want to host an another application in a Tomcat server, for some reasons such as costs or for easy management, you do not want to deploy another server. We can achieve this by configuring Tomcat to host multiple applications in the same server.
This article assumes that you have successfully installed Tomcat and have two or more applications ready to be hosted under a single instance of Tomcat. Installing Tomcat is done the usual way either by installing via the repository or downloading the binary from the official site. Installing via the binary is recommended as we can get a latest/stable version of Tomcat.
Tomcat applications are configured to run on port 8080 by default. This can be altered by tweaking the Tomcat’s configuration file (server.xml) which is crucial to run multiple applications under a single Tomcat instance.
For every application that you need to run under a single instance, you have to edit the server.xml file and add entries for the service. To create an entry for the application in the Tomcat’s configuration file specify the port number, webapps and work directories. Then start Tomcat in the server using the default startup script (startup.sh) located under “bin” directory of your Tomcat installation. Please refer the code below:

Comments

Popular posts from this blog

Introduction to SOLR Search Engine

10 Useful Node JS modules

Firebase Essentials