LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Suse/Novell (http://www.linuxquestions.org/questions/suse-novell-60/)
-   -   Apache redirection between servers (http://www.linuxquestions.org/questions/suse-novell-60/apache-redirection-between-servers-474495/)

marcon 08-16-2006 02:40 PM

Apache redirection between servers
 
hello, ive this problem. Ive got two servers (A and B) working with two diferent domains (x.com (A server) and y.com (B server)), registred at no-ip.com, and working with ddns and bind (for the internal network). inside my network i can reach the correct server with the domain (x.com or y.com) (dig x.com/y.com just works fine). But the servers are behind a linksys router. The router just forwards the port 80 request to one server ip (A server with x.com domain). From outside my network, even if i request y.com, since the public ip is the same, the server that respond is the x.com. i cant reach the y.com server. any sugestions in apache configuration in the x.com server to redirect y.com request to the correct server. Ive already tryed VIRTUALHOST, NAMEVIRTUALHOST, REDIRECT, etc. . Ive already putted BIND (x.com) as slave server to domain y.com. nothing works. Any ideas for me to solve this?
Better yet, the sendmail works just fine. the server A (x.com) relays y.com domain to B server.

Marco Ferreira
Portugal

KenJackson 08-17-2006 03:49 PM

A common solution would be to pick a different port.

For example, in httpd.conf on B, put:
Listen 0.0.0.0:80
Listen 0.0.0.0:8080

Then configure no-ip.com to redirect y.com to your-ip:8080.
And configure your router to redirect incoming port 8080 to B.

That way, users will still be able to just type y.com into their browser to get to your B server.

marcon 08-18-2006 07:55 AM

Yes, ive already know about that solution, but is there another way? Do you know if anyone manage to do it in another way? This is one solution for the problem but if i would really want to use redirection of port 80 what is the right apache configuration? I didnt find any way till now! Ive already spent timeless hours trying to solve the problem! No luck!

KenJackson 08-18-2006 09:35 AM

Quote:

but if i would really want to use redirection of port 80 what is the right apache configuration?
I really use those two Listen lines in my /etc/httpd/conf/httpd.conf file, except I use a different port.

Right now if I were to tell you my (secret) URL and you were to type it into your browser--with no port number--you would be redirected to my web page hosted by a PC that is behind a firewall and only has a local IP addess.

The only disadvantage is that the web browser location bar does not show the (secret) URL, but my external IP address and the port number. I think I can fix this with virtual hosts, but I haven't gotten around to trying.

The only other solution I can even possibly think of is to use a PC running Linux or BSD for a firewall (not a NetGear box) and have iptables do it in the NAT table. I don't know if that's possible or not, but this is such a common problem that I'll bet someone has done it. You could start searching netfilter.org or even the lengthy 'man iptables'.

rhyan-brw 08-22-2006 02:11 AM

I am a newbie in linux world, however my experience shows that routers can redirect a http request to only 1 ip on port 80. However you should check the router help docs to make sure if this is the case. Right now, I have set up apache2 use name-based virtual host on single IP , so I have now 3 virtual hosts x.com, y.com and z.com on 0.0.0.0:80 ip. The apache has good mechanism to handle virtual hosting on a single IP, so if you have set up the name virtual host directive correctly, it should work for you as well on the same IP.

I have used YaST to configure and run the apache server, however note that Suse apache uses includes in its httpd.conf file, so you should open it to see where actually resides the included file for virtual hosts.

If you configure the apache correctly you should have name based virtual hosting running with no problem. Next step is to set up DNS to redirect request for y.com and x.com to the same IP, apache will resolve the correct host via the http headers request, not via IP. If you do not use a DNS server, but hosts file on the remote machines, just assign the x.com and y.com to point to the same IP, no port needed. Hope it will work for you.


All times are GMT -5. The time now is 01:59 PM.