Skip to content

Instantly share code, notes, and snippets.

@ilhamgusti
Created May 21, 2021 10:39
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 ilhamgusti/444fa6030029c1dec0b5990349c04de4 to your computer and use it in GitHub Desktop.
Save ilhamgusti/444fa6030029c1dec0b5990349c04de4 to your computer and use it in GitHub Desktop.
dynamicsubdomain.example.conf
server {
listen *:80;
server_name example.com *.example.com;
set $subdomain "";
if ($host ~ ^(.*)\.example\.com$) {
set $subdomain $1;
}
location / {
proxy_pass http://127.0.0.1:3000;
proxy_set_header X-Subdomain $subdomain;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment