Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game. |
| Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
04-02-2006, 05:04 AM
|
#1
|
|
LQ Newbie
Registered: Mar 2006
Location: Texas
Distribution: Debian Sarge
Posts: 16
Rep:
|
SOLVED: Subdomain->IP?
I have multiple computers on my LAN running Linux and Apache. I have a static IP, which goes through a firewalled router. The router is portforwarding to one computer, and Apache works great. There are no problems with that.
But... I want to have a subdomain - pc2.domain.com - which is served by a different computer on my LAN. Is it possible to tell the apache server at www.domain.com (192.168.1.11) to forward requests to pc2.domain.com (192.168.1.4)'s Apache installation?
I looked into mod_proxy, but setting it up the way that was suggested did not work. pc2.domain.com just times out in the browser.
Is this possible, or does anyone have a httpd.conf section I could use as a basis for figuring this one out?
**EDIT: Fiddling with some settings got mod_proxy to work... sortof... It works on the LAN by basically redirecting my browser to http://192.168.1.4 - my private IP. I don't want that to happen, because people outside the LAN will not be able to connect to it, so mod_proxy does not seem to be the solution 
Last edited by johndmann; 04-03-2006 at 04:32 AM.
|
|
|
|
04-02-2006, 01:32 PM
|
#2
|
|
Moderator
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 42,676
|
mod_proxy at it's basic level is probably just what you want. the address you proxy to within apache is only relevant to apache itself, not the remote user, so you can happily just use a local hostname or IP and it won't care, but then you shouldn't be uisng ip addresses anyway.
|
|
|
|
04-03-2006, 02:03 AM
|
#3
|
|
LQ Newbie
Registered: Mar 2006
Location: Texas
Distribution: Debian Sarge
Posts: 16
Original Poster
Rep:
|
I read up on the modproxy, and edited my post with my results. I will clarify here, though.
I read on apache.org that the basic layout of the mod_proxy should be just like the following:
<VirtualHost *:80>
#ProxyPreserveHost On
ServerName pc2.domain.com
ProxyPass / http://192.168.1.101:80
ProxyPassReverse / http://192.168.1.101:80/
</VirtualHost>
I put all of this in, and it first complained about "ProxyPreseveHost" is not a valid command, so I commented that out, and the rest went through like a charm. I was confused about that error, though, since it's even in the Apache documentation that it is a command.
After restarting Apache with this v-host configuration, if I open a browser and go to http://pc2.domain.com, my browser's address bar changes to http://192.168.1.101, and the site loads for me. However, since it changed to an internal IP address, I asked a friend to test the link out. He typed in http://pc2.domain.com on his browser, and it tried to load http://192.168.1.101 for him instead which, of course, fails.
It's close to what I want, and works on the LAN, but I can't get it to work for everyone else.
|
|
|
|
04-03-2006, 02:37 AM
|
#4
|
|
Moderator
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 42,676
|
it sounds like you've got a DNS looku pgoing on externally resolving to the internal address... that declaration is fine and mod_proxy does use internal addresses... a few things i'd look towards though. firstly drop the :80's in the proxy commands, and also stick a / on the end of the proxypass as that is wrong at the moment.
|
|
|
|
04-03-2006, 03:59 AM
|
#5
|
|
LQ Newbie
Registered: Mar 2006
Location: Texas
Distribution: Debian Sarge
Posts: 16
Original Poster
Rep:
|
 Well, I'll be! According to the apache docs, you're *supposed* to put the port designation in there, and to leave off the slash on the first entry, add it in the second :/ Well, not sure what difference it made internally, but removing the ports and adding the slash made it work perfectly!
Thank you!
Any idea why that ProxyPreserveHost On threw an error? From the looks of it, I didn't need it in the end, though.
Last edited by johndmann; 04-03-2006 at 04:01 AM.
|
|
|
|
04-03-2006, 04:09 AM
|
#6
|
|
Moderator
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 42,676
|
well i guess that putting the port couldn't posibbly hurt... just what you're used to i guess.
as the two declarations aren't symmetrical, translations will go wrong as a link proxied one way can be translated effectively in the other. I would expect that this inconsistency caused the LAN address to be interpretted wrongly by the front end server and passed back the the client.
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 02:23 PM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|