Skip to content

Instantly share code, notes, and snippets.

@anthumchris
Last active February 27, 2018 13:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anthumchris/84a0ab1b8a98ad86869859589e883a9f to your computer and use it in GitHub Desktop.
Save anthumchris/84a0ab1b8a98ad86869859589e883a9f to your computer and use it in GitHub Desktop.
Dynamically route subdomains to respective subdomain folders
server {
listen 80;
listen [::]:80;
server_name ~^(?<subdomain>\w+).dynamic.domain.com;
root /var/www/vhost/_dynamic/$subdomain;
access_log /var/log/nginx/dynamic-access.log;
error_log /var/log/nginx/dynamic-error.log;
autoindex on;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment