Created
May 21, 2021 10:39
-
-
Save ilhamgusti/444fa6030029c1dec0b5990349c04de4 to your computer and use it in GitHub Desktop.
dynamicsubdomain.example.conf
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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