VirtualHost configuration in Apache Tomcat on ubuntu 20.04 LTS - TechBeginner

Welcome to TechBeginner.in, Tech Beginner provides technical blog for Online Linux Tutorials, Ubuntu Tutorials, Redhat Tutorials and CentOS 7, Configuration of server like Web Server, Application server, Database server, Window server, networking, html, css, java script, php, wordpress, opencart, magento, joomla and etc.

VirtualHost configuration in Apache Tomcat on ubuntu 20.04 LTS

Share This


 

Apache Tomcat is a web worker and servlet compartment that is utilized to serve Java applications. Tomcat is an open source usage of the Java Servlet and JavaServer Pages advancements, delivered by the Apache Software Foundation. This instructional exercise covers the essential establishment and some design of the most recent arrival of Tomcat 8 on your Ubuntu 20.04 LTS worker.  

 

To configure virtualhost, Your domain must be ping with your tomcat server IP address for virtual host.

 

In this post, We will configure virtualhost with Apache tomcat8 on ubuntu 20.04 LTS  

 
Step 1: Add Virtualhost configuration 



You need to open the conf/server/xml file and add the following apache tomcat named based virtualhost.



<Host name="www.example.com"  appBase="webapps/example/" unpackWARs="true" autoDeploy="true">
<Alias>www.example.com</Alias>

<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
           prefix="local_access_log" suffix=".txt"
           pattern="%h %l %u %t &quot;%r&quot; %D %s %b" />

<Context path="" docBase="/opt/tomcat/webapps/example/"
   debug="0" reloadable="true"/>
</Host>



Here you need to change or replace the given values.

Hostname   - wwww.example.com
appBase    - webapps/example/
 

Alias      - www.example.com
UnpackWARs - true
autoDeploy - true

and others value leave on default values.

 

Step 2: Restart the Tomcat Service 



To get new changes you need to restart the Apache tomcat service by using the given command.

sudo systemctl restart tomcat

 

 

No comments:

Post a Comment