Apache Tomcat, or simply Tomcat which is the best known, is an open-source web container with servlet and JavaServer Pages support (JSPs) application developed by the Apache Software Foundation. The Tomcat servlet engine it is often presented in combination with the Apache website, As it presents to the environment the Java code needed to run it.
In its simplest form, Tomcat executes a single operation within the system through a process in the Java Virtual Machine. Each subsequent HTTP request from a browser to Tomcat is processed in a separate thread, as Tomcat has the tools and settings needed to manage them. Tomcat settings are stored in simple XML files that can be reviewed and edited with a multitude of tools. In the next tutorial we will teach you how to install this useful tool on your Ubuntu 15.10 Server system, Which for now comes version 8.
Installing Tomcat 8
Installing Tomcat 8, if you haven’t included it in your system installation by default, is as simple as entering the following commands from the terminal:
sudo apt-get install tomcat8 tomcat8-docs tomcat8-admin tomcat8-examples
Answer yes to the question of whether you want to install Tomcat. This will also include the dependencies you have on the Java packages and create the tomcat8 user on your system. In addition, the application will start with its default settings.
If you want to try the app access your domain or IP address of the machine followed by port 8080 from any browser.
You will then see a text stating “It works!”, Along with some other additional information.
Configuring Tomcat 8
The configuration of Tomcat 8 can be modified from the web management interface itself. To enable it and all its features you must edit the file located in /etc/tomcat8/tomcat-users.xml
sudo vi /etc/tomcat8/tomcat-users.xml
Add the following lines:
<role rolename="manager"/> <role rolename="admin"/> <user name="admin" password="secret_password" roles="manager,admin"/>
Save and exit the file edit. You should now be able to view and manage the server from the address http: // tu_dirección_ip: 8080 / manager / html. You will be able to access with the name and password you set in /etc/tomcat8/tomcat-users.xml.
en / Var / lib / tomcat8 the directories are found conf, logs, webapps i work. en webapps is where the servlets will be housed (Or at least the XML configuration file that points to them).
As a way to test the server, you can download the following application file and deploy it through the management page (within the deploy you will be able to see the button to upload the file to your server). Optionally you can run the following command from the webapps of Tomcat i the server will automatically recognize the web application file and expand it without further intervention by you:
Now enter the following path in your browser: http: //your_ip_address:8080 / SimpleServlet /
How to set up Tomcat to listen on port 80
if you want change the Tomcat listening port to 80 you will need to follow the procedure below. First edit the file located in /etc/tomcat8/server.xml.
sudo vi /etc/tomcat8/server.xml
Then find the text where you put it Connector port = »8080″ and replace this value with Connector port = »80″. Save and exit file editing mode.
Now all you have to do is restart the Tomcat server with the following command:
sudo /etc/init.d/tomcat8 restart