At first, we need to know about what is Apache Tomcat? Apache Tomcat is an open source web server and Servlet container for Java code. It runs programs written in the Java programming language and implements many Java EE specifications, including Jakarta Servlets, Jakarta Server Pages, and more. In this tutorial we are going to see how to install apache tomcat in windows and to seploy an web applications.
Steps to Install Apache Tomcat
1. At first, Apache Tomcat is an open-source web server tool developed by Apache Software Foundation (ASF).
2. Download Tomcat from the link below:
After downloading the zip file, unzip the zip file.
3. What is the structure of Tomcat?
It will be as follows.
- Here is a bin folder that contains a script to run/stop the tomcat server.
- Conf folder containing configuration files such as server.xml, tomcat-users.xml, web.xml
- Webapps folder to deploy web applications …
4. The two configurations are the most inappropriate here.
In the Tomcat-users.xml file, add the role and Tomcat server credentials under the <tomcat-users>
tag as below:
<tomcat-users> <role rolename="admin-gui"/> <role rolename="admin-script"/> <role rolename="manager-gui"/> <role rolename="manager-status"/> <role rolename="manager-script"/> <role rolename="manager-jmx"/> <user name="admin" password="admin" roles="admin-gui,admin-script,manager- gui,manager-status,manager-script,manager-jmx"/> </tomcat-users>
You can also add SSL certificates in the server.xml file to change the running port.
Apache will not start the server if the 8080 port is already bound on the system and Tomcat runs on port 8080 by default.
If you want to change the port number, do the following:
<Connector port="8181" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" />
6. After the server starts successfully, you can access the server using the following URL: http://localhost:8181
Clicking on the Manager app will open the Tomcat web page in the Manager app button.
The button prompts for a username and password. Then enter your username and password
It is provided in the tomcat-users.xml file.
7. When the page opens, you’ll see the application running on the Tomcat server.
- Deploy the sample war file to the Tomcat server.
- Download the sample war file from here. Please use the link below: https://tomcat.apache.org/tomcat-5.5-doc/appdev/sample/
Download the sample.war file. You can see the Sample application on the Tomcat website by copying this war to your webapp folder. This is true if you add a sample war file Extraction creates an application folder inside the webapp folder.
Click the sample application link to open a new page http://localhost:8181/sample/ to see the results
The application provided.
If you want to install Jenkin via Tomcat now. Download and copy the Jenkinswar file webapp folder.