Skip to content

Instantly share code, notes, and snippets.

@bentglasstube
Created February 23, 2012 22:44
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save bentglasstube/1895513 to your computer and use it in GitHub Desktop.
Save bentglasstube/1895513 to your computer and use it in GitHub Desktop.
server {
listen 443;
server_name git.eatabrick.org;
error_log /var/log/nginx/git.error.log;
access_log /var/log/nginx/git.access.log;
# ssl because cox sucks
ssl on;
ssl_certificate /etc/nginx/ssl/git.eatabrick.org;
ssl_certificate_key /etc/nginx/ssl/server.key;
root /usr/share/gitweb;
# static repo files for cloning over https
location ~ ^.*\.git/objects/([0-9a-f]+/[0-9a-f]+|pack/pack-[0-9a-f]+.(pack|idx))$ {
root /home/git/repositories/;
}
# requests that need to go to git-http-backend
location ~ ^.*\.git/(HEAD|info/refs|objects/info/.*|git-(upload|receive)-pack)$ {
root /home/git/repositories;
fastcgi_pass unix:/var/run/fcgiwrap.socket;
fastcgi_param SCRIPT_FILENAME /usr/lib/git-core/git-http-backend;
fastcgi_param PATH_INFO $uri;
fastcgi_param GIT_PROJECT_ROOT /home/git/repositories;
include fastcgi_params;
}
# send anything else to gitweb if it's not a real file
try_files $uri @gitweb;
location @gitweb {
fastcgi_pass unix:/var/run/fcgiwrap.socket;
fastcgi_param SCRIPT_FILENAME /usr/share/gitweb/gitweb.cgi;
fastcgi_param PATH_INFO $uri;
fastcgi_param GITWEB_CONFIG /etc/gitweb.conf;
include fastcgi_params;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment