Introduction
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 "%r" %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
Conclusion
We have successfully configured virtualhost configuration in Apache Tomcat on ubuntu 20.04 LTS, Kindly report in case you are facing difficulties with following details.
- OS name
- OS version
- Package name
- Logs – Error / Warning / failed
A lot of of the things you say happens to be supprisingly appropriate and it makes me wonder the reason why I had not looked at this with this light previously. This article really did switch the light on for me personally as far as this particular issue goes. Nonetheless at this time there is actually just one point I am not necessarily too cozy with and whilst I make an effort to reconcile that with the actual main idea of the position, permit me observe just what the rest of the subscribers have to point out.Nicely done.
Thanks for the complement on it.
Thank you for writing this article. I appreciate the subject too.
You’ve been great to me. Thank you!