Issue
Introduction
I have a VPS CENTOS 7.9 kvm running WHM and cPanel v98.0.7.
I have a spring boot application to be deployed.
This application was made to be deployed in a sub-domain of a hosted domain in this WHM.
Problem
How do I deploy a spring boot application to a subdomain in cPanel on my VPS?
References
How to host Spring boot application on cpanel?
https://stackoverflow.com/search?q=VPS+spring+boot
Solution
This solution applied to my hostgator VPS. Consider:
ACCOUNT_NAME to be your account name; DOMAIN_NAME to be your domain name. It can also be a subdomain;
Backup your apache settings:
cp -vp /etc/apache2/conf/httpd.conf{,-BKP}
Uncomment the lines of include in the vhost of the domain. Do it for the HTTP(std) and for the HTTPS(ssl):
vim /etc/apache2/conf/httpd.conf
Once you accessed the file, search the following lines and remove the #
Include "/etc/apache2/conf.d/userdata/std/2_4/ACCOUNT_NAME/DOMAIN_NAME/.conf" Include "/etc/apache2/conf.d/userdata/ssl/2_4/ACCOUNT_NAME/DOMAIN_NAME/.conf"
Create the following directories:
mkdir -p /etc/apache2/conf.d/userdata/std/2_4/ACCOUNT_NAME/DOMAIN_NAME mkdir -p /etc/apache2/conf.d/userdata/ssl/2_4/ACCOUNT_NAME/DOMAIN_NAME
Create a .conf for std and ssl.
vim /etc/apache2/conf.d/userdata/std/2_4/ACCOUNT_NAME/DOMAIN_NAME/ACCOUNT_NAME.conf
vim /etc/apache2/conf.d/userdata/ssl/2_4/ACCOUNT_NAME/DOMAIN_NAME/ACCOUNT_NAME.conf
/etc/apache2/conf.d/userdata/std/2_4/ACCOUNT_NAME/DOMAIN_NAME/ACCOUNT_NAME.conf
RewriteEngine on RewriteCond %{HTTPS} off RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] ProxyPass "/" "http://DOMAIN_NAME:10002/"
/etc/apache2/conf.d/userdata/ssl/2_4/ACCOUNT_NAME/DOMAIN_NAME/ACCOUNT_NAME.conf
ProxyPass "/" "http://DOMAIN_NAME:10002/"
Once you are done, restart the httpd service. service httpd restart
Answered By - KenobiBastila Answer Checked By - Timothy Miller (PHPFixing Admin)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.