1

i have several subdomains(git.example.org, build.example.org, etc.), i have a router with an external ip and i have several virtual machines on a host computer with internal ips. Now i want to route git.example.org to internal ip 10.0.2.1 and build.example.org to internal ip 10.0.2.2. How can I do this?

I setup in the Router that all traffic on port 80 is comming to my host computer with internal ip 10.0.2.3 and installed Squid on that computer.

I added the following lines to the squid.conf file:

cache_peer 10.0.2.1 parent 80 0 no-query originserver name=server_1
cache_peer_domain server_1 git.example.org
cache_peer 10.0.2.2 parent 80 0 no-query originserver name=server_2
cache_peer_domain server_2 build.example.org

But this is not working for me. :( Any help appreciated.

Regards Nils

Update: Here is the solution for Apache

https://serverfault.com/a/273693

Abenil
  • 125
  • 7

1 Answers1

3

Squid isn't exactly the optimum solution for a reverse proxy -- it'll do it with enough prodding, but it's not the tool I would ever use.

For simple proxying needs, I'd use the nginx HttpProxyModule(or Apache's mod_proxy, if your tastes go that way), switching to varnish if caching was a priority. The nice thing about using a webserver is that they're simple, robust, and you probably use them already and hence know a bit about them. Varnish, on the other hand, is a bit more niche, but when you want something that'll cache your content, it really is the duck's nuts.

The thing to remember about all this, though, is that name-based proxy redirection is only for protocols that support indicating the name of the service they're connecting to -- which limits your protocol selection considerably. So, if you're doing anything other than HTTP, you probably want to go talk to your network provider about a few more IPs (despite the fact that we're running out of IPv4 space). It really does make life so much easier.

womble
  • 96,255
  • 29
  • 175
  • 230
  • Thanks for your reply. ;) So here are some more details about what i am planning to do. I have a Gitlab Setup, Jenkins and Jira...and i want to make those applications visible to the internet. I only need HTTP for all of them and SSH for Gitolite on the Github Box...but i can configure the SSH thing in my router i guess, just forward port 22 to the server with Gitolite installed. – Abenil Mar 27 '12 at 10:14
  • I didn't found any help for apache on this topic?! So what do i have to google if not 'reverse proxy'? I will check nginx docs now and will accept your answer if i get it or comeback with some more questions. :P – Abenil Mar 27 '12 at 10:16
  • 1
    Answer updated. – womble Mar 27 '12 at 10:21
  • thank you so much dude ;) i will upvote your answer as soon as i got 15 reputation here. ;) – Abenil Mar 27 '12 at 10:44