1

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 / http://localhost:8067/
  ProxyPassReverse / http://localhost:8067/

</VirtualHost>

This is not working properly. Because with this site enabled, if I type localhost, I am redirected to http://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.

1

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.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.