Skip to content

Instantly share code, notes, and snippets.

@stefanosala
Last active December 19, 2015 11:28
Show Gist options
  • Save stefanosala/5947551 to your computer and use it in GitHub Desktop.
Save stefanosala/5947551 to your computer and use it in GitHub Desktop.
My dynamic vhost configuration on OSX
$TTL 86400
$ORIGIN dev.
@ 1D IN SOA @ root (
424 ; serial (d. adams)
3H ; refresh
15M ; retry
1W ; expiry
1D ) ; minimum
1D IN NS @
1D IN A 127.0.0.1
*.dev. 60 IN A 127.0.0.1
//
// Include keys file
//
include "/etc/rndc.key";
// Declares control channels to be used by the rndc utility.
//
// It is recommended that 127.0.0.1 be the only address used.
// This also allows non-privileged users on the local host to manage
// your name server.
//
// Default controls
//
controls {
inet 127.0.0.1 port 54 allow {any;}
keys { "rndc-key"; };
};
options {
directory "/var/named";
/*
* If there is a firewall between you and nameservers you want
* to talk to, you might need to uncomment the query-source
* directive below. Previous versions of BIND always asked
* questions using port 53, but BIND 8.1 uses an unprivileged
* port by default.
*/
// query-source address * port 53;
};
//
// a caching only nameserver config
//
zone "." IN {
type hint;
file "named.ca";
};
zone "localhost" IN {
type master;
file "localhost.zone";
allow-update { none; };
};
zone "0.0.127.in-addr.arpa" IN {
type master;
file "named.local";
allow-update { none; };
};
logging {
category default {
_default_log;
};
channel _default_log {
file "/Library/Logs/named.log";
severity info;
print-time yes;
};
};
zone "dev" IN {
type master;
file "dev.zone";
allow-update { none; };
};
<Directory /Users/user/Sites>
Options FollowSymLinks Indexes
AllowOverride All
Order Deny,Allow
#Allow from all
</Directory>
UseCanonicalName Off
NameVirtualHost *:80
<VirtualHost *:80>
ServerName dev
ServerAlias *.dev
DocumentRoot /Users/user/Sites
SetEnv LocalDev true
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www.* [NC]
RewriteCond %{HTTP_HOST} ^([^\.]+)\.dev
RewriteCond /Users/user/Sites/%1.dev/web -d
RewriteRule ^(.*) /%1.dev/web/$1 [L]
RewriteCond %{HTTP_HOST} !^www.* [NC]
RewriteCond %{HTTP_HOST} ^([^\.]+)\.dev
RewriteCond /Users/user/Sites.dev/%1 -d
RewriteRule ^(.*) /%1.dev/$1 [L]
<Location />
SetInputFilter DEFLATE
</Location>
</VirtualHost>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment