LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Apache redirecting to a specific port (https://www.linuxquestions.org/questions/linux-newbie-8/apache-redirecting-to-a-specific-port-4175441153/)

societymedia 12-12-2012 10:35 AM

Apache redirecting to a specific port
 
Hi all,

all same machine.

I have an apache webserver using VirtualHosts.

I have a Node server running on port 8080.

What i would like is to have my domain api.domain.com redirect to xx.xx.xx.xx:8080

I would like this to have a clean url that hits my node server.

TIA,
Tony

bathory 12-12-2012 11:07 AM

Hi,

You can define the vhost api.domain.com as a reverse proxy of the node server, i.e use something like the following:
Code:

<VirtualHost *:80>
ServerName api.domain.com
ProxyRequests Off
ProxyPass / xx.xx.xx.xx:8080/
ProxyPassReverse / xx.xx.xx.xx:8080/
...
</VirtualHost>

Regards

societymedia 12-12-2012 12:25 PM

Thank you for your reply. I have changed my httpd to this:

<VirtualHost xx.xx.xx.xx:80>
ServerName api.domain.com
ProxyRequests Off
ProxyPass / xx.xx.xx.xx:8080/
ProxyPassReverse / xx.xx.xx.xx:8080/
</VirtualHost>

and i get:
Syntax error on line 1021 of /etc/httpd/conf/httpd.conf:
ProxyPass URL must be absolute!

Any ideas?

Thanks :)

bathory 12-12-2012 12:40 PM

My bad. It should be:
Code:

ProxyPass / http://xx.xx.xx.xx:8080/
ProxyPassReverse / http://xx.xx.xx.xx:8080/


societymedia 12-12-2012 12:43 PM

Im sorry.. I should i tried that! :) Thank you sir! Im up and running !! you guys rock!


All times are GMT -5. The time now is 07:18 PM.