Linux - NetworkingThis 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.
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.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Is there a way I can forward a request for a domain to another box on my LAN? Here's the juice:
I have a Linksys router (WRT54G) which I port forward 80 to my Apache server. I have another box connected to this router that I also run Apache on, but want to host another/different domain (I know I can host the domain on the same server, but I want to know if I can do it on different boxes) on. I am wondering if there is an entry that I can place in my apache conf's to get this to work out, some sort of Vhost entry:
<VirtualHost 192.168.1.40>
</VirtualHost>
But I don't know if that's even correct. For examples sake, let's call my private IP's the following:
Main Server: 192.168.1.20
New Server hosting Apache for new domain: 192.168.1.40
Any suggestions welcome, and I just figured since this is likely *mostly* related to networking (although it would certainly have also fit in several other forums) I'd post it here. Feel free to move it accordingly
Cool
Oh yes, forgot to mention I do not want to run on different service ports.
Is it possible to forward like this, but to the same machine, just on a different port? Then have apache ignore what happens to it?
I guess so, though I'm not really sure why you'd want to. If you have multiple server instances on the same physical box, you should probably be doing name based VirtualHosts (And no, you *can't* use this to bypass the multiple SSL certs on a single IP/port problem)
To answer your question, your rewrite would look like:
Yay, finally it works. I'd already tried what you posted and had no luck. Now i just found that if i include mod_proxy_http it works ok. Silly me!
Quote:
Originally posted by sigsegv I guess so, though I'm not really sure why you'd want to. If you have multiple server instances on the same physical box, you should probably be doing name based VirtualHosts (And no, you *can't* use this to bypass the multiple SSL certs on a single IP/port problem)
I kinda thought i was using name based vhosts, i guess i got mixed up then somewhere. No idea about the SSL thing though, lol. Thats way above my head.
Originally posted by kola I kinda thought i was using name based vhosts, i guess i got mixed up then somewhere. No idea about the SSL thing though, lol. Thats way above my head.
Perhaps I should approach this another way -- Why do you have Apache listening on more than one port on the same server?
Originally posted by sigsegv Perhaps I should approach this another way -- Why do you have Apache listening on more than one port on the same server?
Ah, I dont. I have apache running once, but another httpd (custom) is also running for another purpose. So apache should serve any requests to the normal pages (mydomain.com) and pass anything for otherdomain.com to the other httpd on a different port.
When i learn more about php, SSI and CGI i will probably get apache to handle everything, but until then this is the best way to keep my pages working.
That make sense?
So far i have this, which seems to work. But there might be a better/more secure way to do it.
Thank you for posting this. Is here anyway to attach in the rewrite URL the fact that this request is for whatever . com? Cause the way it is now, the second server (I think) will not know that this request is for whatever . com.
Now ... This will get interesting because the webserver that this lives on will have to have a host file entry for 'www.whatever.com'. If the webserver looked up www.whatever.com through DNS it would get it's own IP address back (assuming it uses the internet to resolve the domain and not a local DNS server). Most of the time when you're using Apache as a transparent proxy it's just to one server with one domain being served on it.
I wrote this in a hurry. I hope it makes senses and helps answer your question.
I know this thread is old but hopefully still followed.
My problem is that I'm using a Virtual Server to server another page that's running a linux apache.
The physical server runs windows server (serves fine) VMware running ubuntu server
Using your rewrite help I successfully (sort of) server requests to the virtual server. The problem is that in changing the domain to an ip address when serving pages from outside the network. Obviously from within the network it works just fine.
So from the outside world when I go to the domain it serves the initial page just fine but all links are now 192.168.1.41/whatever
Is there anyway to make that rewrite 2 directional so that when the virtual server sends info back it does so as the domain that I'm entering?
I greatly appreciate your help
Update: Nevermind!
The problem was with the virtual machines wordpress install having the loopback address for its domain in the settings. After giving wordpress the domain name to use instead everything works just fine. Leaving this pot here in case someone else needs it. Thanks again for your help
Last edited by iammrbt; 12-23-2014 at 09:56 PM.
Reason: im dumb
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.