Created
May 27, 2015 07:49
-
-
Save OscarGalindo/005a12eed9d77906989e to your computer and use it in GitHub Desktop.
Dynamic vhost to nginx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; | |
| } | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
DNSMasq
echo "address=/.dev/127.0.0.1" >> /etc/dnsmasq.conf