Geekzone: technology news, blogs, forums
Guest
Welcome Guest.
You haven't logged in yet. If you don't have an account you can register now.


pstar008

362 posts

Ultimate Geek
+1 received by user: 6


#62532 9-Jun-2010 12:16
Send private message

Hi, I've setup apache servers for personal projects using my home file server and desktop PC. Now I ended up
need find a way for them to share port 80 from my single IP address.

I think the answer is reverse proxy mod in Apache? Any start point for setting up one in Debian server?

Create new topic
chriswiggins
413 posts

Ultimate Geek
+1 received by user: 5


  #339790 9-Jun-2010 13:57
Send private message

Something like the following. Substitute IP1 as the IP address (internally) of the PC that is going to be doing the proxy'ing. Replace IP2 with the IP address of the other PC's IP address. DomainName of PC2 should be straight forward :) (note that this will not work going straight to an IP address as this relies on NameBased Forwarding. Get a dyndns or no-ip domain if you need to - that is another topic)

<VirtualHost IP1:80>
        ServerName pc2.domainname.co.nz
        DocumentRoot /var/www/
        ProxyRequests Off

        <Proxy *>
          Order deny,allow
          Allow from all
        </Proxy>

        ProxyPass / http://IP2:80/
        ProxyPassReverse / http://IP2:80/
</VirtualHost>

Hope that helps! I use many many of these in my vhosts file. You can place in apache.conf if you don't have a vhosts.conf (or similar)

Can actually use these to get past firewall issues too as the :80 can be changed to a non-standard port. E.g your web monitoring software runs on 1154 so you just change to IP2:1154 and off you go!

Please ask if you have more questions!
Cheers
Chris



JAMMAN2110
872 posts

Ultimate Geek
+1 received by user: 4

Trusted

  #339794 9-Jun-2010 14:03
Send private message

Why not combine them as a Virtual Host for each project on the one server?

pstar008

362 posts

Ultimate Geek
+1 received by user: 6


  #340456 10-Jun-2010 22:31
Send private message

Hi Chris, thank you for the help, I finally get a chance to test it tonight, and it works!

I am on a Debian Lenny, so the proxy setting is on mods-available/proxy.conf. And as I am using named-based virtual host on PC2 I changed IP2 to server2's name.

Thanks again for the great helps.



pstar008

362 posts

Ultimate Geek
+1 received by user: 6


  #340576 11-Jun-2010 11:53
Send private message

@Jamman2010
Yes, put them all into a machine with vhost will certainly solve me problem, but I guess I am
just been lazy and think that there must be a way of doing that.

k1wi
484 posts

Ultimate Geek
+1 received by user: 111


  #340578 11-Jun-2010 11:58
Send private message

I have a couple of homedns configured using vhosts, very straightforward :)

Though I did manage to borge it one day when I removed the first line of the file thinking it was just superfluous! Turns out it was the line that tells apache that there is more than one vhost :o

JAMMAN2110
872 posts

Ultimate Geek
+1 received by user: 4

Trusted

  #340586 11-Jun-2010 12:14
Send private message

pstar008: @Jamman2010
Yes, put them all into a machine with vhost will certainly solve me problem, but I guess I am
just been lazy and think that there must be a way of doing that.


Don't get me wrong, I use vhosts and mod_proxy all the time. But given that its at home there doesn't seem to be much point..

<VirtualHost *:80>
 DocumentRoot /var/www/site1/www
 ServerName blah.com
 ServerAlias www.blah.com
</VirtualHost>

Minimalist but it works ;)

 
 
 

Stream your favourite shows now on Apple TV (affiliate link).
pstar008

362 posts

Ultimate Geek
+1 received by user: 6


  #341451 14-Jun-2010 11:26
Send private message

Hi Jamman2110

My question is how to have two servers serve http request to one IP address and one port, but I failed to see how ServerAlias going to solve that?

Create new topic








Geekzone Live »

Try automatic live updates from Geekzone directly in your browser, without refreshing the page, with Geekzone Live now.



Are you subscribed to our RSS feed? You can download the latest headlines and summaries from our stories directly to your computer or smartphone by using a feed reader.