Skip to content

Instantly share code, notes, and snippets.

@Shikkic
Created September 29, 2016 03:03
Show Gist options
  • Save Shikkic/2d86df86ad5008c84eea1baa1f54e9d5 to your computer and use it in GitHub Desktop.
Save Shikkic/2d86df86ad5008c84eea1baa1f54e9d5 to your computer and use it in GitHub Desktop.
server {
listen [::]:80;
listen 0.0.0.0:80;
# Redirect stdout/stderr to logs.
access_log /var/log/nginx/access.log main;
error_log /var/log/nginx/error.log warn;
# Make the depot volume the root to make cgi simpler.
root /repos;
# Disable maximum body sizes since upload-packs can get pretty big.
client_max_body_size 0;
# Public read-only git requests.
location ~ ^.*\.git/(info/refs|git-(upload)-pack)$ {
root /repos;
fastcgi_pass unix:/tmp/cgi.sock;
fastcgi_param SCRIPT_FILENAME /usr/lib/git-core/git-http-backend;
fastcgi_param PATH_INFO $uri;
fastcgi_param GIT_PROJECT_ROOT /repos;
fastcgi_param GIT_HTTP_EXPORT_ALL "";
fastcgi_param REMOTE_USER $remote_user;
include fastcgi_params;
}
# Send anything else to gitweb if it's not a real file
try_files $uri @gitweb;
location @gitweb {
fastcgi_pass unix:/tmp/cgi.sock;
fastcgi_param SCRIPT_FILENAME /var/www/git/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