3

Sorry if the question is not that clear.

To illustrate what I want to do, I will give an example:

Application Link:

http://123.123.123.123:8080/KagodPaMore/

Domain:

http://www.iyotbihagay.com/

I wanted my application to be accessed using the link:

http://www.iyotbihagay.com:8080/KagodPaMore/

Also, I wanted it to redirect to the link above whenever the user will enter the following links:

http://www.iyotbihagay.com:8080/
http://www.iyotbihagay.com/

I have no idea on how to implement this.
- My application is served in Amazon EC2
- My domain service is on only-domains (but I cannot see any port options there where I could set the port)
- My server is JBoss Wildfly utilizing port 8080
- I have apache web server installed using port 80 (but not used)
- My amazon server (virtual) is configured on Ubuntu 14.04

hope someone could guide me in the right direction since I do not know how I could set this.

TIA

Borgy Manotoy
  • 1,960
  • 5
  • 27
  • 42

2 Answers2

3

Application Link:
http://123.123.123.123:8080/KagodPaMore/

Domain:
http://www.iyotbihagay.com/

Objective:
http://www.iyotbihagay.com/ OR http://www.iyotbihagay.com/KagodPaMore/

Processes or Steps done to solve the issue:
* Use Apache Virtual Host - Proxy for default port (80):

For ubuntu apache: You may edit the default site configuration (/etc/apache2/sites-available/000-default.conf).
Add Virtual Host for port 80 to serve as proxy for the port 8080 and KagodPaMore application.

<VirtualHost *:80>    
    ServerName localhost    
    ProxyPreserveHost On    
    ProxyRequests off    

    <Proxy *>    
        Order deny,allow    
        Allow from all    
    </Proxy>       

    ProxyPass /KagodPaMore http://localhost:8080/KagodPaMore/    
    ProxyPassReverse /KagodPaMore http://localhost:8080/KagodPaMore/    

    ProxyPass / http://localhost:8080/KagodPaMore/    
    ProxyPassReverse / http://localhost:8080/KagodPaMore/    
</VirtualHost>   

Save changes on the site configuration.
Restart Apache 'sudo service apache2 restart'

Now, you may access the application using:
* http://localhost:8080/KagodPaMore/
* http://localhost:8080/

Note: Do this on the server (123.123.123.123).

With this, you access the server like 'http://123.123.123.123/' it will be pointed to 'http://123.123.123.123:8080/KagodPaMore/' Or Locally like 'http://localhost/' it will be pointed to 'http://localhost:8080/KagodPaMore/'

Set your Domain Server's Main Address (Example: OnlyDomains) to '123.123.123.123'.

This is if you will use the domain server's own NS Servers.
For OnlyDomains, edit 'iyotbihagay.com' zone records and set

'@' - A Record -> '123.123.123.123'  
'www' - A Record -> '123.123.123.123'  

If you will delegate your own NS Server, make sure that you set your NS servers to point to '123.123.123.123'.

This way, you can I can access my web application by:
http://www.iyotbihagay.com/ or http://www.iyotbihagay.com/KagodPaMore/

Good Luck!

Borgy Manotoy
  • 1,960
  • 5
  • 27
  • 42
  • Admirably succinct ty. However how would this be modified for Ghostcat protection and secret at the virtual host configuration? – cp. Aug 19 '22 at 12:13
0

You can do:

  1. Map your domain name to IP address, i.e. create A record www.iyotbihagay.com to 123.123.123.123. No need to specify port in here. If you use Elastic Load Balancer (ELB), you can create a CNAME record to your ELB endpoint.
  2. Configure Apache to accept request from port 80 and redirect it to port 8080. You can use mod_alias or mod_rewrite.
  3. For the same thing, you need to configure JBoss Wildfly to rewrite/redirect the URL. (disclaimer: I'm not familiar with JBoss Wildfly)
  4. Ensure to allow ingress to port 80 and 8080 on your Security Group.
Edward Samuel
  • 3,846
  • 1
  • 22
  • 39