Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Apache Tomcat webserver topic #723

Merged
merged 1 commit into from
Dec 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,14 @@ We cover a wide range of DevOps topics in our content library, explore them unde
<td>IIS</td>
<td><a href="./topics/iis/">iis</a></td>
<td>📖 <a href="https://learn.microsoft.com/en-us/iis/">learn.microsoft.com/iis</a></td>
<td>⏩ <a href="./topics/iis/basic/">IIS Basics</a></td>
<td>✔️ <a href="./topics/iis/basic/">IIS Basics</a></td>
</tr>
<tr>
<td><img height="28" width="32" src="https://tomcat.apache.org/res/images/tomcat.png" /></td>
<td>Apache Tomcat</td>
<td><a href="./topics/apachetomcat/">tomcat</a></td>
<td>📖 <a href="https://tomcat.apache.org/">tomcat.apache.org</a></td>
<td>✔️ <a href="./topics/apachetomcat/basic/">Tomcat Basics</a></td>
</tr>
</table>

Expand Down
91 changes: 91 additions & 0 deletions topics/apachetomcat/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
# Apache Tomcat

## 1. What is Apache Tomcat?

### Overview

Apache Tomcat (called "Tomcat" for short) is a free and open-source implementation of the Jakarta Servlet, Jakarta Expression Language, and WebSocket technologies. It provides a "pure Java" HTTP web server environment in which Java code can also run. Thus it is a Java web application server, although not a full JEE application server.
Tomcat is developed and maintained by an open community of developers under the auspices of the Apache Software Foundation, released under the Apache License 2.0 license.

Source: https://en.wikipedia.org/wiki/Apache_Tomcat

### Official Website of Apache Tomcat

- https://tomcat.apache.org/

### Official Documentation of Apache Tomcat

- https://tomcat.apache.org/tomcat-10.1-doc/

### What you can do with Apache Tomcat

- Host Java-based web applications.
- Implement and run Java Servlet and JSP technologies.
- Lightweight and highly customizable deployment platform.
- See details at: https://tomcat.apache.org/tomcat-10.1-doc/introduction.html

---

## 2. Prerequisites

- Basic knowledge of Java and web server technologies.
- Java Development Kit (JDK) installed on your system.

---

## 3. Installation

### How to Install Apache Tomcat?

1. **Download Apache Tomcat**:

- Visit the official [Apache Tomcat Downloads](https://tomcat.apache.org/download-10.cgi) page.
- Choose the version that matches your needs (e.g., Tomcat 10.1).

2. **Install Java**:

- Ensure JDK is installed on your system. Apache Tomcat requires Java to run.
- [Install JDK Guide](https://docs.oracle.com/en/java/javase/17/install/overview-jdk-installation.html)

3. **Extract and Configure Tomcat**:

- Extract the downloaded archive to a desired directory.
- Set the `CATALINA_HOME` environment variable to the Tomcat installation path.

4. **Start Tomcat**:

- Navigate to the `bin` directory of your Tomcat installation.
- Run `startup.bat` (Windows) or `./startup.sh` (Linux/Mac).

5. **Verify Installation**:
- Open a browser and go to `http://localhost:8080`. You should see the Tomcat welcome page.

---

## 4. Basics of Apache Tomcat

### Get started with Apache Tomcat

- https://tomcat.apache.org/tomcat-10.1-doc/setup.html

### Apache Tomcat quick start guide

- Set up and deploy your first servlet or JSP application:
- [Getting Started Guide](https://tomcat.apache.org/tomcat-10.1-doc/appdev/index.html)

### Apache Tomcat Hands-On

- See: [basic](./basic/)

---

## 5. More...

### Apache Tomcat Cheatsheet

- https://www.javacodegeeks.com/starting-with-apache-tomcat-cheatsheet.html

### Recommended Books

- **Tomcat: The Definitive Guide** by Jason Brittain.
- **Professional Apache Tomcat 8** by Vivek Chopra, et al.
47 changes: 47 additions & 0 deletions topics/apachetomcat/basic/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Apache Tomcat Basics

This section covers the fundamental concepts and steps to get started with Apache Tomcat. Learn how to set up, configure, and deploy web applications.

---

## 1. Getting Started with Apache Tomcat

### Starting the Server

1. Open the terminal and navigate to the `bin` directory of your Tomcat installation.
2. Run the startup script:
- **Windows**: `startup.bat`
- **Linux/Mac**: `./startup.sh`

### Stopping the Server

1. Navigate to the `bin` directory.
2. Run the shutdown script:
- **Windows**: `shutdown.bat`
- **Linux/Mac**: `./shutdown.sh`

---

## 2. Configuring Apache Tomcat

### Change the Default Port

1. Open the `server.xml` file located in the `conf` directory.
2. Locate the `<Connector>` element and change the `port` attribute:

```xml
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
```

---

## 3. Deploying a Sample Application

- Deploy a Pre-Built `.war` File
- Download a sample `.war` file
- Download the sample application Sample Web Application at https://tomcat.apache.org/tomcat-10.1-doc/appdev/sample/
- Deploy to Tomcat
- Copy the `.war` file into the webapps directory of your Tomcat installation.
- Access the Application: Open a browser and navigate to http://localhost:8080/sample.