0

At home, I have two different computers that are running web servers. One is a Linux NAS and one is a PC running Spiceworks.

After recently installing the NAS, I would like to be able to access it from example1.example.com, while still being able to access Spiceworks at example2.example.com. I don't want to have to use port fowarding to differentiate.

Currently, accessing either hostname goes to Spiceworks, because of the port fowarding that I already have set up.

My router doesn't have the ability to do virtual hosting, and I can't combine the two webservers onto one machine because Spiceworks has to run on Windows. Is there any method I can use to properly direct request to the correct webserver?

2
  • Forgive me I don't understand the question....Forward hostnames? Forwarding users makes more sense.
    – mdpc
    Commented Apr 30, 2014 at 18:56
  • Sorry if it's a little unclear: I basically want to be able to access webserver 1 at example1.example.com and server 2 at example2.example.com, and both servers are in the same network.
    – user201262
    Commented Apr 30, 2014 at 18:59

1 Answer 1

0

You basically have 3 options, depending on what your router can do and what resources you have available:

A different port

This is the easiest option: One port (e.g. 80) forwards to one of your servers, while another (e.g. 8080, a common "alternative" HTTP port) forwards to the other. I know you said you didn't want to do this, but it's the easiest option so I'm listing it here for completeness.

A second IP

If you can assign a second external IP address to your router (and you can get one from your ISP/you're willing to pay for one from your ISP), you can direct one DNS entry to one IP, port forwarded to one of your servers, while the other goes to the second IP, port forwarded to the other server. Many routers -- especially your off-the-shelf consumer routers -- don't support this, however; too, many ISPs don't offer the option of additional IPs, and those that do frequently charge insane prices for them (the typical exception being hosting providers of the rack or VPS variety).

A reverse proxy

This is probably easiest to set up on your Linux server, rather than your Windows server. Basically you would change your router to forward all traffic to the Linux server; there, your web server would have one virtual host for example1.example.com, which would serve up the website that lives on it, and another for example2.example.com, which would reverse proxy to the Spiceworks server as its "upstream". How exactly this is implemented is dependent upon what web server you're using, but in both Apache and nginx this is relatively simple to do. You could also set up a third box to serve as the proxy, directing traffic to the appropriate server based on the hostname.

3
  • The reverse proxy looks like a good solution, but I'm not as familiar with it. The NAS I'm working with allows me to directly edit the php.ini config file. Could I start there?
    – user201262
    Commented Apr 30, 2014 at 19:21
  • @Moses Ah, I misread your question, missed that it was a NAS. php.ini won't get you there, but if you have access to the web server's configuration (and specifically to the ability to set up virtual hosts), then you may be able to do it there. Otherwise you'll need to find a way to do it on Windows (I don't know if IIS has reverse proxying capabilities, but you can always install Apache or nginx after moving Spiceworks to another port) or else use a third server for the proxying.
    – Kromey
    Commented Apr 30, 2014 at 19:24
  • Gotcha, well I'm in httpd.conf, now I just have to figure out how to forward requests to the other server.
    – user201262
    Commented Apr 30, 2014 at 19:58

You must log in to answer this question.