Redirect domain / subdomain to IP with port

1

I have a server where I host all my webs, it is a private server and I have a fixed IP address.

The problem is that I have a single IP, port 80 goes to a server and 8082 to the server that we have to host the webs, the other is to other web topics.

Now I want to be able to redirect a domain www.domain.com to the IP 111.111.1.1:8082

My doubt is that, after researching a lot about how to do it, I can not make the configuration.

In principle in the domain, I should put my public IP with the port and then on the server a htaccess so that it redirects according to the domain from which it is accessed, right?

Any ideas?

    
asked by Diego 28.11.2016 в 09:32
source

1 answer

3

You can not use ProxyPass in .htaccess . The documentation says that it is only applicable to the context:

  

Context: server config, virtual host, directory

Therefore, what you should do is create a virtual host, to be able to redirect www.domain.com to the IP 111.111.1.1:8082

<VirtualHost *:80>
    ServerName dominio.com
    ServerAlias www.dominio.com

    ProxyPass / http://111.111.1.1:8082/
    ProxyPassReverse / http://111.111.1.1:8082/
</VirtualHost>

Greetings.

    
answered by 28.11.2016 / 10:48
source