guycalledavinash / apache-tomcat

Time to deploy web app'ns

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Apache tomcat is java based and is a web server container for web applications

Let's take a look at how it's installed and deploy a simple html application

Server Setup in VM

ec2 instance: t2.micro

since this java based, java is a pre-requisite

download tomcat tar file, I've used tomcat 9:

wget https://dlcdn.apache.org/tomcat/tomcat-9/v9.0.86/bin/apache-tomcat-9.0.86.tar.gz

extract the tar file:

tar xvzf apache-tomcat-9.0.86.tar

rename for convinience:

mv apache-tomcat-9.0.86.tar tomcat

enter the tomcat foler where these files are seen among others

bin : has files related to start, stop services, etc
conf : has configuration files including server.xml to change port
webapps : this is where the web applications are deployed

go to bin directory and enable startup.sh file, this enables the tomcat server in port 8081, enable this in security settings

sh startup.sh

files

This fires up the server: 1

But we can't access it yet, it won't let us: 2

Enable the Service

To enable the service, we should allow all users and configure their credentials.

  1. Allow all users to access the portal by configuring the details in context.xml file in this directory
webapps\manager\META-INF\

find and edit that file

vi context.xml

this is how the default script look like: 3 under <value section, allow all users by changing it to this:

allow=".*"

It should look like this: 4

  1. Add users and configure the username, password

From conf directory, edit tomcat-users.xml file by pasting this script just above </tomcat-users> at the bottom

This is how it is by default: 4

Modify this: 5

  1. Restart it by going to bin
sh startup.sh
sh shutdown.sh

Server should be up, showcasing all the folders s1

We can upload/deploy artifacts using GUI here s2

Checkout these two repositories to see how to package, deploy artifacts: Maven, Nexus

I deployed a war file s3

Upon opening the file s4

About

Time to deploy web app'ns