Skip to content

Instantly share code, notes, and snippets.

@gleicon
Last active August 29, 2015 14:06
Show Gist options
  • Save gleicon/b1325364b1ced98ccb56 to your computer and use it in GitHub Desktop.
Save gleicon/b1325364b1ced98ccb56 to your computer and use it in GitHub Desktop.
nginx per vhost documentroot + tag insert
server {
listen 80;
server_name ~^(www\.)?(?<siteid>.+)\.domain\.com$;
log_format timed_combined '$remote_addr - $remote_user [$time_local] '
'"$request" $status $body_bytes_sent '
'"$http_referer" "$http_user_agent" '
'$request_time $pipe';
access_log /var/log/nginx/static_sites.domain.log timed_combined;
root /var/www/$siteid;
location / {
root /var/www/$siteid;
sub_filter </head> '\n<!-- insert tag for $siteid -->\n</head>';
sub_filter_once on;
index index.html index.htm;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment