Mobile app version of vmapp.org
Login or Join
Merenda212

: How to redirect a domain to IP+port? I have a website on localhost. On the other hand, I have a program running on localhost:8067. I would like to manage the next: Type localhost on the

@Merenda212

Posted in: #Apache #Apache2 #Subdomain

I have a website on localhost. On the other hand, I have a program running on localhost:8067.

I would like to manage the next:


Type localhost on the URL and go to the website.
Type my.domain.com on the URL and go to the program.


I am using Apache2 to achieve this, but I cannot.

I created a site in /etc/apache2/sites-available and enabled it:

<VirtualHost *:80>

ServerName my.domain.com
# ServerAlias my.domain.com

ProxyRequests Off
ProxyPreserveHost On

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

ProxyPass / localhost:8067/ ProxyPassReverse / localhost:8067/
</VirtualHost>


This is not working properly. Because with this site enabled, if I type localhost, I am redirected to localhost:8067/, which I do not want, because if I type localhost, I have to see the website.

Anyone can help me? Thank you in advance.

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Merenda212

1 Comments

Sorted by latest first Latest Oldest Best

 

@Speyer207

Not sure whether this will be of any help to you. Please ignore if it was not.

You will have to create two hosts files to achieve this:

Host File 01:
asking the server to listen at 80, for requests for localhost, and feed the root directory through port 80 to those requests.

Host File 02:
asking the server to listen at 80, for requests for my.domain.com and feed the root directory through port 8062 to those requests.

I cannot give you the exact apache configuration for this, because I am more familiar with nginx configuration. However, since you created the above configuration yourself, you won't be having difficulty creating what I said.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme