Skip to content

Instantly share code, notes, and snippets.

@nmix
Last active January 10, 2017 06:57
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 nmix/29ad921d314108e48d6885f491983a55 to your computer and use it in GitHub Desktop.
Save nmix/29ad921d314108e48d6885f491983a55 to your computer and use it in GitHub Desktop.
nginx subdomain configuration for multiple rails apps
# source: http://server-tuning.info/nginx/auto-subdomains-nginx.html
server {
listen 80;
server_name example.com *.example.com;
passenger_enabled on;
rails_env production;
root /path/to/project/$subdomain/current/public;
set $subdomain "";
if ($host ~* ^([a-z0-9-\.]+)\.zstaging.xyz$) {
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