TurnKey Linux Virtual Appliance Library

Wrapping my brain around apache2 and serving from one IP

Ric Moore's picture

I'm reading all the howtos to set up /etc/apache2/available-hosts/ using promix and turnkey containers.

I remain just a bit confused. Each container has it's own virtual IP address. The proxmox install currectly has the static public IP addressed and assigned to it. That works. Now, what is the best way to configure things so that apache2 routes incoming requests to the proper internal IP addresses and then become passed back to the net through the single IP address? If someone if familiar with this I have googled my backside off and need a nudge in the right direction for this network newbie. Thanks! Ric

Jeremy's picture

A reverse proxy...

Sounds like what you need is a reverse proxy. This will allow you to point all your omain names to your external IP and the reverse proxy can sort which domain (or sub domain) gets routed to which internal IP. Apache (or other webserver such as LigHTTPd or NginX, etc) can be configured to act as a reverse proxy on one of your existing VMs or you can set up a dedicated reverse proxy. Squid can also be configured as a reverse proxy from what I've read and another one that I have heard is really easy to configure and use is Pound (available from the repos),

Chris Musty's picture

Router using NAT also call port forwarding

Network address translation or NAT allows you to serve up many services from a single IP. Most routers can achieve NAT and basically you connect to your service by specifying a non standard port eg if my routers IP was 100.200.150.250 then I could type 100.200.150.250:8888 and forward that port to the internal IP of my web server with port 80 so effectively 100.200.150.250:8888 translates to say 192.168.0.100:80 I think this approach is easier by far than a reverse proxy and no additional configuration required. Look up your router model for port forwarding and you will find the exact config to do it.

Chris Musty

Director

Specialised Technologies

Jeremy's picture

Good call Chris (as per always...)

In addition, some Dynamic DNS providers (such as ChangeIP.org) allow you to forward a FQDN to a port e.g. you could configure http://ric.onmypc.org (standard http port 80) to forward to http://100.200.150.250:8888 (using Chris' example external IP).

Once you have your router configured (as Chris suggests above) and Dynamic DNS (as I suggest) this setup would effectively forward http://ric.onmypc.org to http://192.168.0.100 (via your router).

You could do this with multiple FQDNs (mapped to different external ports on your router) and no need for a reverse proxy! :)

Ric Moore's picture

What I'd rather have

Is all of my containers handled by the base Apache2 running.  All have same domainname, just different Proxmox local hostnames and IP adddresses. You know, as usual. I want to configure our dns at our provider to send all requests to them to go to the same IP address at the proxmox server and have Apache2 send them to their approrpiate container/server.

 

This issue, and adding certs, boggles my old and tired mind. I'd kill for a nice SIMPLE gui to manage it all. Ric


Post new comment

The content of this field is kept private and will not be shown publicly. If you have a Gravatar account, used to display your avatar.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <p> <span> <div> <h1> <h2> <h3> <h4> <h5> <h6> <img> <map> <area> <hr> <br> <br /> <ul> <ol> <li> <dl> <dt> <dd> <table> <tr> <td> <em> <b> <u> <i> <strong> <font> <del> <ins> <sub> <sup> <quote> <blockquote> <pre> <address> <code> <cite> <strike> <caption>

More information about formatting options

Leave this field empty. It's part of a security mechanism.
(Dear spammers: moderators are notified of all new posts. Spam is deleted immediately)