LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Suse/Novell
User Name
Password
Suse/Novell This Forum is for the discussion of Suse Linux.

Notices

Reply
 
Search this Thread
Old 08-16-2006, 02:40 PM   #1
marcon
LQ Newbie
 
Registered: Jan 2006
Distribution: OPEN SUSE
Posts: 6

Rep: Reputation: 0
Angry 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
 
Old 08-17-2006, 03:49 PM   #2
KenJackson
Member
 
Registered: Jul 2006
Location: Maryland, USA
Distribution: Fedora, Arch
Posts: 572

Rep: Reputation: 64
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.
 
Old 08-18-2006, 07:55 AM   #3
marcon
LQ Newbie
 
Registered: Jan 2006
Distribution: OPEN SUSE
Posts: 6

Original Poster
Rep: Reputation: 0
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!
 
Old 08-18-2006, 09:35 AM   #4
KenJackson
Member
 
Registered: Jul 2006
Location: Maryland, USA
Distribution: Fedora, Arch
Posts: 572

Rep: Reputation: 64
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'.
 
Old 08-22-2006, 02:11 AM   #5
rhyan-brw
LQ Newbie
 
Registered: Nov 2005
Posts: 16

Rep: Reputation: 0
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.
 
  


Reply

Tags
apache, iptables


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Need help with WWW redirection in apache ice99 Linux - Networking 3 08-06-2006 12:02 AM
redirection in apache ice99 Linux - Networking 3 07-17-2006 12:24 PM
Redirection in Apache gonzo22 Linux - Networking 5 02-12-2005 09:54 AM
Apache - Redirection problem... elitecodex Linux - Software 5 03-29-2004 10:12 PM
apache redirection failing acid_kewpie Linux - Networking 2 08-15-2002 04:29 PM


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

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration