Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- From b26ad104cffe9e6c37bb141c040213e4f497783a Mon Sep 17 00:00:00 2001
- From: =?UTF-8?q?Fernando=20Fl=C3=B3rez?= <fernando@funciton.com>
- Date: Mon, 8 Feb 2010 20:20:19 -0500
- Subject: [PATCH] Nginx sendfile config.
- ---
- app/controllers/trees_controller.rb | 2 +-
- config/gitorious.sample.yml | 6 ++++++
- 2 files changed, 7 insertions(+), 1 deletions(-)
- diff --git a/app/controllers/trees_controller.rb b/app/controllers/trees_controller.rb
- index cc5b4f3..d765750 100644
- --- a/app/controllers/trees_controller.rb
- +++ b/app/controllers/trees_controller.rb
- @@ -94,7 +94,7 @@ class TreesController < ApplicationController
- protected
- def set_xsendfile_headers(real_path, user_path, content_type = "application/x-gzip")
- - response.headers["X-Sendfile"] = File.join(GitoriousConfig["archive_cache_dir"], real_path)
- + response.headers["X-Accel-Redirect"] = GitoriousConfig["nginx_sendfile_dir"] + real_path
- response.headers["Content-Type"] = content_type
- user_path = user_path.gsub("/", "_")
- response.headers["Content-Disposition"] = "Content-Disposition: attachment; filename=\"#{user_path}\""
- diff --git a/config/gitorious.sample.yml b/config/gitorious.sample.yml
- index 914a8c8..1405c5e 100644
- --- a/config/gitorious.sample.yml
- +++ b/config/gitorious.sample.yml
- @@ -58,3 +58,9 @@ test:
- # Pick a default license
- #default_license: GNU Affero General Public License (AGPLv3)
- +
- + # If you are using nginx instead of apache set the "internal" dir where your archive tarballs are stored
- + # end slash is important, nginx config example:
- + # location /cache { root /path/where/archive_cache_dir/is; internal; }
- + # remember to turn sendfile on -> html { sendfile on; }
- + nginx_sendfile_dir: "/cache/"
- --
- 1.6.6
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement