Apache Tomcat VM by Anarion Technologies
Apache Tomcat is a widely-used open-source web server and servlet container that provides a powerful platform for hosting and managing Java-based web applications. Developed by the Apache Software Foundation, Tomcat is known for its reliability, performance, and scalability in handling web traffic and executing Java Servlets, JavaServer Pages (JSP), and other Java-based technologies.
Tomcat serves as a key component in the Java EE (Enterprise Edition) ecosystem, offering developers and organizations a flexible environment for building and deploying dynamic web applications. It supports a range of features including HTTP/2, WebSocket, SSL/TLS encryption, and integration with various databases and authentication mechanisms.
With its modular architecture, Tomcat allows for easy customization and extension through additional components and plugins, enabling developers to tailor the server to meet specific application requirements. Its robust management tools and monitoring capabilities make it suitable for both development and production environments, ensuring efficient deployment and maintenance of web applications.
To subscribe to this product from Azure Marketplace and initiate an instance using the Azure compute service, follow these steps:
1. Navigate to Azure Marketplace and subscribe to the desired product.
2. Search for “virtual machines” and select “Virtual machines” under Services.
3. Click on “Add” in the Virtual machines page, which will lead you to the Create a virtual machine page.
4. In the Basics tab:
- Ensure the correct subscription is chosen under Project details.
- Opt for creating a new resource group by selecting “Create new resource group” and name it as “myResourceGroup.”
5. Under Instance details:
- Enter “myVM” as the Virtual machine name.
- Choose “East US” as the Region.
- Select “Ubuntu 18.04 LTS” as the Image.
- Leave other settings as default.
6. For Administrator account:
- Pick “SSH public key.”
- Provide your user name and paste your public key, ensuring no leading or trailing white spaces.
7. Under Inbound port rules > Public inbound ports:
- Choose “Allow selected ports.”
- Select “SSH (22)” and “HTTP (80)” from the drop-down.
8. Keep the remaining settings at their defaults and click on “Review + create” at the bottom of the page.
9. The “Create a virtual machine” page will display the details of the VM you’re about to create. Once ready, click on “Create.”
10. The deployment process will take a few minutes. Once it’s finished, proceed to the next section.
To connect to the virtual machine:
1. Access the overview page of your VM and click on “Connect.”
2. On the “Connect to virtual machine” page:
- Keep the default options for connecting via IP address over port 22.
- A connection command for logging in will be displayed. Click the button to copy the command. Here’s an example of what the SSH connection command looks like:
“`
ssh [email protected]
“`
3. Using the same bash shell that you used to generate your SSH key pair, you can either reopen the Cloud Shell by selecting >_ again
or going to https://shell.azure.com/bash.
4. Paste the SSH connection command into the shell to initiate an SSH session.
Usage/Deployment Instructions
Anarion Technologies – Tomcat
Note: Search product on Azure marketplace and click on “Get it now”
Click on Continue
Click on Create
Creating a Virtual Machine, enter or select appropriate values for zone, machine type, resource group and so on as per your choice.
After Process of Create Virtual Machine. You have got an Option Go to Resource Group Click Go to Resource Group
Click on the Network Security Group: tomcat-nsg
Click on Inbound Security Rule
Click on Add
Add Port
Destination Port Ranges Section* (where default value is 8080)
8080
Select Protocol as TCP
Option Action is to be Allow
Click on Add
Click on Refresh
Copy the Public Address
In your browser, you can now access Tomcat by navigating to the IP address of your server:
http://”instance ip address:8080″
You’ll see the default Tomcat welcome page:
To Access Manager Services
SSH into VM through Terminal and run these following commands:
$ nano /opt/tomcat/conf/ tomcat-users.xml
Replace this text
<?xml version=”1.0″ encoding=”UTF-8″?>
<!–
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership The ASF licenses this file to You under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributedunder the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
–>
<tomcat-users xmlns=”http://tomcat.apache.org/xml”
xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance”
xsi:schemaLocation=”http://tomcat.apache.org/xml
tomcat-users.xsd” version=”1.0″>
<!– Define roles –>
<role rolename=”manager-gui”/>
<role rolename=”manager-script”/>
<role rolename=”manager-jmx”/>
<role rolename=”manager-status”/>
<!– Define users –>
<user username=”admin” password=”admin_password” roles=”manager-gui,manager-script,manager-jmx,manager-status”/>
<user username=”tomcat” password=”tomcat_password” roles=”tomcat”/>
<user username=”both” password=”both_password” roles=”tomcat,role1″/>
<user username=”role1″ password=”role1_password” roles=”role1″/>
</tomcat-users>
Save CTRL+X and SHIFT+Y Enter
Note
Users: Define users and assign them the appropriate roles. Make sure to replace admin_password
,tomcat_password
, both_password
, and role1_password
with your chosen passwords.
Edit the context.xml File
$ sudo nano /opt/tomcat/webapps/manager/META-INF/context.xml
Comment out or remove the RemoteAddrValve element to allow access from any IP address. For security reasons, you may want to restrict access to specific IP addresses instead of allowing all.
To allow access from any IP address, modify it like this:
Or Replace with this text
<?xml version=”1.0″ encoding=”UTF-8″?>
<!–
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
–>
<Context antiResourceLocking=”false” privileged=”true” >
<CookieProcessor className=”org.apache.tomcat.util.http.Rfc6265CookieProcessor”
sameSiteCookies=”strict” />
<!– <Valve className=”org.apache.catalina.valves.RemoteAddrValve”
allow=”127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1″ /> –>
<Manager sessionAttributeValueClassNameFilter=”java\.lang\.(?:Boolean|Integer|Long|Number|String)|org\.apache\.catalina\.filters\.CsrfPreventionFilter\$LruCache(?:\$1)?|java\.util\.(?:Linked)?HashMap”/>
</Context>
Save CTRL+X and SHIFT+Y Enter
$ sudo systermctl restart tomcat
In your browser, you can now access Tomcat by navigating to the IP address of your server:
http://”instance ip address:8080″
ThankYou!!!