Apache: Forward request to another box?
Hello!
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. Thanks! |
main server (192.168.1.20)
Code:
<VirtualHost *:80> |
Awesome, thanks! Will give it a try right now.
Cool |
Quote:
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? |
It works perfect, thanks!
Cool |
Quote:
To answer your question, your rewrite would look like: Replace 8080 with your port number of course. |
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:
cheers lee |
Quote:
|
Quote:
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. Code:
LoadModule rewrite_module modules/mod_rewrite.so |
Hi sigsegv,
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. Thanks, George |
George;
If I understand your question correctly I believe this is what you're looking for: Code:
<VirtualHost *:80> I wrote this in a hurry. I hope it makes senses and helps answer your question. |
almost there!
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 |
All times are GMT -5. The time now is 09:48 PM. |