Right now I'm doing this with the following Apache directives to map host names to port numbers:
NameVirtualHost *:80
<VirtualHost *:80>
ServerName local.stardust-game.com
ProxyPass / http://127.0.0.1:5555/ retry=0
</VirtualHost>
<VirtualHost *:80>
ServerName local.wdi-toolbelt.com
ProxyPass / http://127.0.0.1:9992/ retry=0
</VirtualHost>
(On my development machine, the local.*
domains are set to 127.0.0.1
in my hosts file.)
I'm just looking for a convenient way to run multiple apps of arbitrary origin (some are Ruby, some are Python, etc.) that are accessed through port 80 but by different hostnames.
Apache seems like overkill, and I want to check my gut feeling that there's a much simpler way to do this.
I'm guessing that the solution must involve checking the Host
header of all incoming requests, since without that there is no way to know what process the request is intended for, but again, it feels like overkill to have Apache running just to perform this request forwarding. I'm literally not using it for anything else--just proxying requests to different processes running on the same machine.
- Is
nginx
a more lightweight, or perhaps easier-to-configure solution? - For development purposes, is there a compelling reason not to write a small C/Ruby/Python script that does this? (I'm thinking that something like this already exists and I just don't know what it's called. "Virtual proxy host multiplexing"?)
- Would such a script be stupid to use in staging/production?
- Is there a way to do this or something similar to it without needing to check the
Host
header?