PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Monday, August 1, 2022

[FIXED] How to deploy my Spring Boot application in these circumstances?

 August 01, 2022     java, spring-boot, vps     No comments   

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/questions/25660899/spring-boot-actuator-application-wont-start-on-ubuntu-vps?r=SearchResults&s=1|118.4887

https://stackoverflow.com/questions/53933273/spring-boot-2-on-vps-cant-be-accessed?r=SearchResults&s=2|112.0267

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;

  1. Backup your apache settings:

    cp -vp /etc/apache2/conf/httpd.conf{,-BKP}

  2. 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

  3. 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"

  4. 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

  5. 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

  6. /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/"

  7. /etc/apache2/conf.d/userdata/ssl/2_4/ACCOUNT_NAME/DOMAIN_NAME/ACCOUNT_NAME.conf

    ProxyPass "/" "http://DOMAIN_NAME:10002/"

  8. Once you are done, restart the httpd service. service httpd restart



Answered By - KenobiBastila
Answer Checked By - Timothy Miller (PHPFixing Admin)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing