Skip to content

Instantly share code, notes, and snippets.

@gipi
Last active September 27, 2015 20:58
Show Gist options
  • Select an option

  • Save gipi/1330564 to your computer and use it in GitHub Desktop.

Select an option

Save gipi/1330564 to your computer and use it in GitHub Desktop.
Domain dependent web root directory in #nginx. Need version 0.7.40
server {
listen 80; ## listen for ipv4
# if we have www.miao.bau then the variables defined from
# the regex are $1 = www and $2 = miao.bau
server_name localhost ~^(www\.)?(.+)$;
access_log /var/log/nginx/localhost.access.log;
location / {
root /var/www/$2;
index index.html index.htm;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment