Skip to content

Instantly share code, notes, and snippets.

@aadityataparia
Last active February 6, 2019 22:00
Show Gist options
  • Save aadityataparia/edca37f8f2735347fb50b7801867f8ee to your computer and use it in GitHub Desktop.
Save aadityataparia/edca37f8f2735347fb50b7801867f8ee to your computer and use it in GitHub Desktop.
Wildcard subdomains config in nginx
server {
listen 80;
listen [::]:80 default;
listen 443 ssl;
index index.php index.html;
server_name ~^(?<subdomain>[^.]+).example.com;
root /var/www/$subdomain;
}
@aadityataparia
Copy link
Author

abcd.example.com will be served from /var/www/abcd folder

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment