Skip to content

Instantly share code, notes, and snippets.

@ricsiga
Last active November 23, 2022 14:19
Show Gist options
  • Save ricsiga/e67db4ea4def36370dcfc25154f47104 to your computer and use it in GitHub Desktop.
Save ricsiga/e67db4ea4def36370dcfc25154f47104 to your computer and use it in GitHub Desktop.
virtual document root for Nginx
# [0-9].example.com -> /srv/tickets.example.com/[0-9]/app/build
# http://nginx.org/en/docs/http/server_names.html
server {
listen 80;
server_name "~^(?<subdomain>^\d).example.com$";
root /srv/tickets.example.com/$subdomain/app/build;
}
# [projectname].[user].example.com -> /home/$user/dev/$projectname/web;
server {
listen 81;
server_name "~^(?<project>.+)\.(?<user>.+)\.example\.com$";
root /home/$user/dev/$project/web;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment