Skip to content

Instantly share code, notes, and snippets.

@pacren
Created May 11, 2017 00:57
Show Gist options
  • Select an option

  • Save pacren/97dffa1a260b0a8fd0bdca139ce819d2 to your computer and use it in GitHub Desktop.

Select an option

Save pacren/97dffa1a260b0a8fd0bdca139ce819d2 to your computer and use it in GitHub Desktop.
настройка nginx для поддоменов
server {
listen 80;
server_name example.com *.example.com;
root /var/www/example.com/$subdomain;
set $subdomain "";
if ($host ~* ^([a-z0-9-\.]+)\.example.com$) {
set $subdomain $1;
}
if ($host ~* ^www.example.com$) {
set $subdomain "";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment