Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- upstream foo_app_server {
- server unix:/var/run/foo/unicorn.sock fail_timeout=0;
- }
- # foo Server
- server {
- listen 80;
- client_max_body_size 500M;
- server_name _ foo.com ec2-107-20-213-109.compute-1.amazonaws.com *.foo.com;
- gzip on;
- gzip_http_version 1.0;
- gzip_vary on;
- gzip_comp_level 6;
- gzip_proxied any;
- gzip_types text/plain text/html text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
- # make sure gzip does not lose large gzipped js or css files
- # see http://blog.leetsoft.com/2007/7/25/nginx-gzip-ssl
- gzip_buffers 16 8k;
- # ~2 seconds is often enough for most folks to parse HTML/CSS and
- # retrieve needed images/icons/frames, connections are cheap in
- # nginx so increasing this is generally safe...
- keepalive_timeout 5;
- # path for static files
- root /home/app/rails/foo/current/public;
- access_log /home/app/rails/foo/current/log/nginx.access.log;
- error_log /home/app/rails/foo/current/log/nginx.error.log;
- # this rewrites all the requests to the maintenance.html
- # page if it exists in the doc root. This is for capistrano's
- # disable web task
- if (-f $document_root/system/maintenance.html) {
- rewrite ^(.*)$ /system/maintenance.html last;
- break;
- }
- location / {
- try_files $uri $uri.html $uri/index.html @app;
- }
- location @app {
- proxy_pass http://foo_app_server;
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
- proxy_set_header Host $http_host;
- }
- location /images/ {
- # serve from disk and set expires
- expires max;
- }
- location /stylesheets/ {
- expires max;
- }
- location /javascripts/ {
- expires max;
- }
- location /system/ {
- expires max;
- }
- # Rails error pages
- error_page 500 502 503 504 /500.html;
- location = /500.html {
- root /home/app/rails/foo/current/public;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement