-   SUSE / openSUSE (
-   -   Apache redirection between servers (

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 ( (A server) and (B server)), registred at, and working with ddns and bind (for the internal network). inside my network i can reach the correct server with the domain ( or (dig 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 domain). From outside my network, even if i request, since the public ip is the same, the server that respond is the i cant reach the server. any sugestions in apache configuration in the server to redirect request to the correct server. Ive already tryed VIRTUALHOST, NAMEVIRTUALHOST, REDIRECT, etc. . Ive already putted BIND ( as slave server to domain nothing works. Any ideas for me to solve this?
Better yet, the sendmail works just fine. the server A ( relays domain to B server.

Marco Ferreira

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:

Then configure to redirect 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 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


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 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, and on 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 and 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 and to point to the same IP, no port needed. Hope it will work for you.

All times are GMT -5. The time now is 12:45 AM.