Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Here is my situation

home network, windows machines, 1 external facing IP address (that allows port 80) 1 windows home server always on machine, planning on upgrading to WHS 2011 soon. several IP cameras which use their own webserver and are accessed directly.

My problem/goal:

Id like to be able to externally access my IP cameras and servers on my home network by subdomain, over port 80. ie: cam1.mydomain.com , cam2.mydomain.com, nas.mydomain.com, etc.

They are currently set up with port forwarding, but many networks where I work out of have all non standard ports locked down so I need them to all be on port 80. As I understand it, this cannot be done at the router level and would need to be done at the webserver level, which is fine.

In essence this is just internally routing to different servers depending on subdomain, which Im hoping is a common problem with a relatively simple solution.

let me know if I left anything out. thanks in advance.

(btw, IIS is preferable to apache if all things equal)

share|improve this question
1  
Since this is home gear Superuser would be the more appropriate place to ask it. The answer however is likely to be "no" -- Your firewall has no concept of hostnames (only IP addresses), so you'd need a dedicated external IP for each device you want to access. You may be able to hack something together using Apache as a proxy/reverse proxy, but it would be ugly. A VPN is probably the best solution here. –  voretaq7 May 25 '11 at 16:01

2 Answers 2

If you are accessing the services via HTTP (i.e. in a web browser directly rather than via a plugin or some other client application) then you can do this using something like nginx as a reverse proxy - it can choose where to send each request it proxies for depending on the incoming "host" header line (by having one "server" directive for each sub-domain with its own proxy-pass settings).

You would not be able to do this on your router unless you are running some custom firmware that runs (or allows you to install) a program like nginx that can act as a reverse-proxy like this, but if you port-forward TCP80 to a machine running nginx then the technique will work.

https://help.ubuntu.com/community/Nginx/ReverseProxy gives an example config for nginx as a reverse proxy (there will be many more examples around if you need more). Many other web servers or any apps designed specifically to provide reverse proxy services should be able to do this for you. Apache can if you have mod_proxy (which IIRC is generally present but not loaded by default). IIRC IIS can't without 3rd part add-ons (which may cost) but there are Windows builds of most of the open source tools that can do the job so you can still used them even if you are an entirely Windows environment.

share|improve this answer

You can do this by running one apache instance on your public address (in practice this just means forwarding port 80 from your router to any internal box that can run apache for you) and defining a virtual host for each of the subdomains and using proxy pass to pass it to the real, internal addresses:

<VirtualHost *:80>
    ServerName cam1.domain.com

    ProxyRequests Off
        <Proxy *>
            Order deny,allow
            Allow from all
    </Proxy>
    ProxyErrorOverride On                       
    ProxyPass / http://192.168.1.123/
    ProxyPassReverse / http://192.168.1.123/
    <Location />
    Order allow,deny
        Allow from all
    </Location>

</VirtualHost>


<VirtualHost *:80>
    ServerName cam2.domain.com

    ProxyRequests Off
        <Proxy *>
            Order deny,allow
            Allow from all
    </Proxy>
    ProxyErrorOverride On                       
    ProxyPass / http://192.168.1.124/
    ProxyPassReverse / http://192.168.1.124/
    <Location />
    Order allow,deny
        Allow from all
    </Location>

</VirtualHost>

Where cam1 is internally 192.168.1.123 and cam2 192.168.1.124 etc.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.