This article explains how to deploy a JAVA web application which have MySQL database in DigitalOcean. You have to do following steps in order.
- Create a Droplet with Ubuntu 16.04
- Install Apache Tomcat 8
- Install MySQL
- Install phpMyAdmin
- Set Up Apache Virtual Hosts
These steps are already explained as Tutorials in DigitalOcean community. So, I will use those tutorials and connect them with the required modifications.
First you have to create and DigitalOcean and create a droplet which is a virtual private server. This is explained in the following tutorial with several steps and you have to follow each and every step of this.
How To Create Your First DigitalOcean Droplet Virtual Server | DigitalOcean
Once you log into DigitalOcean, you will need to create your first server. This tutorial will walk you through the…
Now you can access,
* Tomcat default splash page :
* Tomcat manager :
Next you have to install Apache Tomcat 8 on Ubuntu 16.04 droplet. For this you have to follow each and every step of this tutorial one by one.
If the Step 3 in this tutorial not work for you, then the easiest way to solve this is that manually download from https://tomcat.apache.org/download-80.cgi and SCP the inside directory set and files into /opt/tomcat directory of the droplet.
How To Install Apache Tomcat 8 on Ubuntu 16.04 | DigitalOcean
Apache Tomcat is a web server and servlet container that is used to serve Java applications. Tomcat is an open source…
Next you have to install MySQL in order to setup you database in the droplet. For this you have to follow each and every step of this tutorial one by one.
How To Install MySQL on Ubuntu 16.04 | DigitalOcean
MySQL is an open-source database management system, commonly installed as part of the popular LAMP (Linux, Apache…
Next step is to install phpMyAdmin in order to manage the databases in the droplet. For this you have to follow each and every step of this tutorial one by one.
How To Install and Secure phpMyAdmin on Ubuntu 16.04 | DigitalOcean
While many users require access to a database management system like MySQL, not all users feel comfortable interacting…
Now you can access phpMyAdmin :
The final step is to setup your virtual host which redirects the request coming to
http://<droplet-IP>:8080 where the JAVA web application you are going to deploy in your droplet.
You need to have Apache installed in order to work through these steps. You can get Apache installed on your server through
sudo apt-get install apache2
Before configuring Apache, you should enable the necessary modules.
Next, you are going to modify the default configuration file
/etc/apache2/sites-enabled to set up "proxying" functionality.
Run the following command to edit the default Apache virtual host using the nano text editor:
Here, you will be defining a proxy virtual host using
mod_proxy together. Copy-and-paste the below block of configuration, amending it to suit your needs:
ProxyPass / http://0.0.0.0:8080/
ProxyPassReverse / http://0.0.0.0:8080/
Press CTRL+X and confirm with Y to save and exit.
Once you are done with your configuration, you will need to restart the cloud server for the changes to go into effect. Execute the following command to restart Apache:
service apache2 restart
And that’s it! Your installation of prerequisites are complete now! Your are now free to deploy your own Java web applications using Tomcat manager.
Since you have configured port 80 to redirect into 8080 now you can access Tomcat manager using
Create the war file of your web application. Then go to WAR file to deploy section of Tomcat manager and upload the war file and Deploy.
That’s it! You are done with deploying your JAVA web application in DigitalOcean.
Now you can access your web application :
Apache Tomcat® - Apache Tomcat 8 Software Downloads
Welcome to the Apache Tomcat ® 8.x software download page. This page provides download links for obtaining the latest…