Created
January 13, 2012 23:16
-
-
Save jiphex/1609290 to your computer and use it in GitHub Desktop.
Nginx smart app deployment
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
#user nobody; | |
worker_processes 1; | |
#error_log logs/error.log; | |
error_log logs/error.log notice; | |
#error_log logs/error.log info; | |
pid logs/nginx.pid; | |
events { | |
worker_connections 1024; | |
} | |
http { | |
passenger_root /var/lib/gems/1.8/gems/passenger-3.0.11; | |
passenger_ruby /usr/bin/ruby1.8; | |
include mime.types; | |
default_type application/octet-stream; | |
sendfile on; | |
keepalive_timeout 65; | |
gzip on; | |
server { | |
access_log logs/b.log; | |
passenger_enabled on; | |
listen 9090; | |
server_name ~^([a-zA-Z0-9\_\-]+).apps.example.com; | |
root /srv/ruby/$1/public; | |
charset utf-8; | |
} | |
# just a redirect | |
server { | |
passenger_enabled on; | |
listen 9090; | |
server_name apps.example.com; | |
charset utf-8; | |
location ~ favicon.ico { | |
return 404; | |
} | |
location ~ ^/([a-z0-9\-\_]+)/? { | |
rewrite ^/index.html$ http://appindex.apps.example.com last; | |
rewrite /([a-z0-9\-\_]+)/(.*) http://$1.apps.example.com/$2 break; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment