SHARE
TWEET

Untitled

a guest Jan 8th, 2012 84 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. From b26ad104cffe9e6c37bb141c040213e4f497783a Mon Sep 17 00:00:00 2001
  2. From: =?UTF-8?q?Fernando=20Fl=C3=B3rez?= <fernando@funciton.com>
  3. Date: Mon, 8 Feb 2010 20:20:19 -0500
  4. Subject: [PATCH] Nginx sendfile config.
  5.  
  6. ---
  7.  app/controllers/trees_controller.rb |    2 +-
  8.  config/gitorious.sample.yml         |    6 ++++++
  9.  2 files changed, 7 insertions(+), 1 deletions(-)
  10.  
  11. diff --git a/app/controllers/trees_controller.rb b/app/controllers/trees_controller.rb
  12. index cc5b4f3..d765750 100644
  13. --- a/app/controllers/trees_controller.rb
  14. +++ b/app/controllers/trees_controller.rb
  15. @@ -94,7 +94,7 @@ class TreesController < ApplicationController
  16.    
  17.    protected
  18.      def set_xsendfile_headers(real_path, user_path, content_type = "application/x-gzip")
  19. -      response.headers["X-Sendfile"] = File.join(GitoriousConfig["archive_cache_dir"], real_path)
  20. +      response.headers["X-Accel-Redirect"] = GitoriousConfig["nginx_sendfile_dir"] + real_path
  21.        response.headers["Content-Type"] = content_type
  22.        user_path = user_path.gsub("/", "_")
  23.        response.headers["Content-Disposition"] = "Content-Disposition: attachment; filename=\"#{user_path}\""
  24. diff --git a/config/gitorious.sample.yml b/config/gitorious.sample.yml
  25. index 914a8c8..1405c5e 100644
  26. --- a/config/gitorious.sample.yml
  27. +++ b/config/gitorious.sample.yml
  28. @@ -58,3 +58,9 @@ test:
  29.  
  30.    # Pick a default license
  31.    #default_license: GNU Affero General Public License (AGPLv3)
  32. +  
  33. +  # If you are using nginx instead of apache set the "internal" dir where your archive tarballs are stored
  34. +  # end slash is important, nginx config example:
  35. +  # location /cache { root /path/where/archive_cache_dir/is; internal; }
  36. +  # remember to turn sendfile on -> html { sendfile on; }
  37. +  nginx_sendfile_dir: "/cache/"
  38. --
  39. 1.6.6
RAW Paste Data
Top