Skip to content

Instantly share code, notes, and snippets.

@OscarGalindo
Created May 27, 2015 07:49
Show Gist options
  • Select an option

  • Save OscarGalindo/005a12eed9d77906989e to your computer and use it in GitHub Desktop.

Select an option

Save OscarGalindo/005a12eed9d77906989e to your computer and use it in GitHub Desktop.
Dynamic vhost to nginx
server {
index index.html index.htm index.php;
set $basepath "/var/www";
set $domain $host;
if ($domain ~ "^(.[^.]*)\.dev$") {
set $domain $1;
set $rootpath "${domain}";
set $servername "${domain}.dev";
}
server_name $servername;
autoindex on;
access_log "/var/log/nginx/server.${servername}.access.log";
error_log "/var/log/nginx/server.dev.error.log";
root $basepath/$rootpath;
# disallow access to apache configs
location ~ /\.ht {
deny all;
}
# disallow access to git configs path
location ~ /\.git {
deny all;
}
}
@OscarGalindo

Copy link
Copy Markdown
Author

DNSMasq

echo "address=/.dev/127.0.0.1" >> /etc/dnsmasq.conf

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment