Featured post

Learn Basics of Computer

What is Computer ? Computer is an electronic data processing machine which accepts input data from the user, stores the input data in its memory, processes the input data according to given instructions and finally gives us the desired output. What are Data ? Data are the raw facts and figures in the form of bits and bytes. What is information ? Information is processed data. Components of Computer Computer has two components. Such as: Hardware Software What is Hardware ? All the parts of computer that we can see and touch are known as hardware. Example - Keyboard, Mouse, Monitor, etc. What is Software ? A set of statements written in a programming language is known as a instruction. A set of instructions is known as a program. A set of programs is known as a software. Example - Microsoft Windows, Adobe Photoshop, Typing Master, etc. Classification of Computers Computers can be classified into three categories. Those are: According to type of dat...

Deploying A WAR File in EasyApache 4 and Tomcat (Experimental)

 Recently EasyApache 4 started to provide Tomcat support on an experimental basis. After migrating from EasyApache 3 to EasyApache 4 it becomes very difficult and confusing for users to deploy and configure their web application (.war) in their VPS server. I also faced the same problem. Below are the short instructions on how I solved the problem.


First of all, you need to read below documents.


https://documentation.cpanel.net/display/EA4/Tomcat


https://httpd.apache.org/docs/current/mod/mod_proxy_ajp.html


Now follow the below instructions.


1) Build your web app - let's go with a .war file for example purposes. Rename it to ROOT.war.


2) In your VPS server go to the /home/user-name/ea-tomcat85/webapps location


3) Copy your ROOT.war file into the location (Step 2)


4) Go to /home/user-name/ea-tomcat85/conf file. There you should find a server.xml file.


5) Use the command vi server.xml to view the server.xml file. Find the Ajp/1.3 connector port. It should look something like this:


1
<Connector port="10001" protocol="AJP/1.3" redirectPort="10002"/>
Remember the port number is 10001.


6) Now go to this location: /etc/apache2/conf.d/userdata/std/2/user-name/your-domain-name/


Now create a file named custom.conf.


Write the below code:


1
<IfModule proxy_ajp_module>
2

3
ProxyPass "/" "ajp://127.0.0.1:HERE_YOUR_REMEMBERED_AJP_PORT/"
4

5
</IfModule>
Finally, save it.


This gives your website HTTP access.


7) Now got to the following location: /etc/apache2/conf.d/userdata/ssl/2/user-name/your-domain-name/


Create a file named custom.conf.


Write the below code:


1
<IfModule proxy_ajp_module>
2

3
ProxyPass "/" "ajp://127.0.0.1:HERE_YOUR_REMEMBERED_AJP_PORT/"
4

5
</IfModule>
Finally, save it.


This gives your server HTTPS access


8) Now you need to rebuild the HTTPD, so use the below command


1
/usr/local/cpanel/scripts/rebuildhttpdconf
And now restart the HTTPD by using the below command:


1
/usr/local/cpanel/scripts/restartsrv_httpd
Note: In case your website is not working yet, follow the below instructions.


Reboot your VPS server or do the same thing but in a new Tomcat location, which is /opt/cpanel/ea-tomcat85.


After doing everything, use the below command to start a Tomcat server manually:


1
/opt/cpanel/ea-tomcat85/bin/./startup.sh
If you need to shutdown Tomcat manually, use the below command:


1
/opt/cpanel/ea-tomcat85/bin/./shutdown.sh
Topics: APACHE, TOMCAT 8, VPS SERVER, WEB DEV
Opinions expressed by DZone contributors are their own.


Popular on DZone
Microservices Patterns: Sidecar
8 Keys to Failproof App Modernization
How to Use Pattern Matching for instanceof From JDK16
How the Worldwide Chip Shortage Affects IoT

Comments

Popular posts from this blog

CakePHP 3.10 Content Management Tutorial

How to Install Croogo CMS on Ubuntu 18.04 LTS

How to Build a Dedicated Web Server : 4 Steps