boxen/our-boxen — pull request #343 by createdbypete (2013-07-10 16:54:27+00:00)
Title: Add Nginx wildcard subdomain to projects template

Submitting this as I was used to the default behaviour of [Pow](http://pow.cx/manual.html#section_2.1.1). This will accept all subdomain requests for a project.

With Nginx this `.<%= @server_name %>` would match both the exact name and the wildcard but I believe separately it is more obvious what we are listening for.

An [exact name will also override a wildcard match](http://wiki.nginx.org/HttpCoreModule#server_name) so there will be no conflict.

The removal of the "www" if block was because it appears to serve no purpose, and if you want a redirect for `www.` there is a more efficient method:

```nginx
server {
server_name www.<%= @server_name %>;
return 301 $scheme://$host$request_uri;
}
```