A vhost proxy doodad thing.
Use distra to give serve static directories while developing, and to give servers running on your computer nice URLs.
Set up hosts (urls) and routes (directories or proxy targets (moar urls)) using JSON, and then feel like a boss.
It also adds to your hosts file (safely) so you never have worry about that either!
I had so many servers, particularly serving static files, that I never knew what was being served and on which port. So I built this so I'd never have to care again... and neither will you.
Clone the repository (tho it may be an npm module at some point)
git clone git://github.com/phuu/distra.gitcd distra && npm install
config.sample.json file to
config.json and add your own setup.
Any hosts you add will also need to go in your
hosts file. Distra does this for you, unless you specify pass it
Here's an example.
In the example above, requests made to
http://mysite.dev/ will be proxied through to the server running on port 4000 (a Jekyll server, perhaps). Requests made to
project will be served static files from the directory specified.
This will fire up the proxy server on a default port, and you can get to work straight away with the hosts you specified and the port it gives you.
I recommend starting on port 80 so you don't have to mess around with ports!
sudo node . 80
By default, distra modifies your hostsfile. To turn this off, pass
sudo node . 80 --no-hosts
If you don't use the built hosts file functionality you'll need to add any new hosts to your hosts file. On OSX you'll find it at
It might look like this, for example:
127.0.0.1 mysite.dev127.0.0.1 project
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE