12Nov

Pro-am tip: Wildcard DNS and You!

Posted by Elf Sternberg as programming, site administration

In my first post on Continual Integration Testing of Web Applications with Facebook, I mentioned setting up the Hudson server, fronted by Nginx, as the first step.  It would be nice if I could also refer to that application by something other than a port number.  Rather than “http://elfsternberg.com:8080”, I wanted to be able to go to “hudson.elfsternberg.com.”

If your registrar supports it (and mine does), use a wildcard.  Your A records should look like this:

@                   64.71.152.125
*.elfsternberg.com  64.71.152.125

Now, it’s possible to set up the front-end by using Nginx and hostname-based routing:

server {
        listen          80;
        server_name     hudson.elfsternberg.com;
        location / {
                proxy_pass http://127.0.0.1:10080;
... 

And viola! Nginx will match that as a requested hostname, and route you to the correct server, with the security settings you put on it. You can even put an SSL key in front of it (I ought to, since BasicAuth is very, um, Basic). You can set up as many third-level DNS entries as you want off your base URL without having to do any DNS manipulation at all.

Obviously, this scales like a whale, but for small, personal projects, it’s a good thing.

Comment Form

Subscribe to Feed

Categories

Calendar

November 2009
M T W T F S S
« Oct   Dec »
 1
2345678
9101112131415
16171819202122
23242526272829
30