Last active
January 10, 2017 06:57
-
-
Save nmix/29ad921d314108e48d6885f491983a55 to your computer and use it in GitHub Desktop.
nginx subdomain configuration for multiple rails apps
This file contains 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
# 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