summaryrefslogtreecommitdiff
path: root/cgit.conf
diff options
context:
space:
mode:
Diffstat (limited to 'cgit.conf')
-rw-r--r--cgit.conf56
1 files changed, 56 insertions, 0 deletions
diff --git a/cgit.conf b/cgit.conf
new file mode 100644
index 0000000..f4f54a3
--- /dev/null
+++ b/cgit.conf
@@ -0,0 +1,56 @@
+server {
+ server_name git.sanders.life ;
+
+ access_log /var/log/nginx/cgit-access.log;
+ error_log /var/log/nginx/cgit-error.log debug;
+
+ root /usr/share/cgit;
+ try_files $uri @cgit;
+
+ # this location block causes the 403
+ location @cgit {
+ include fastcgi_params;
+ fastcgi_param SCRIPT_FILENAME /usr/lib/cgit/cgit.cgi;
+ fastcgi_param DOCUMENT_ROOT /usr/lib/git-core;
+ fastcgi_pass unix:/run/fcgiwrap.socket;
+
+ fastcgi_param PATH_INFO $uri;
+ fastcgi_param QUERY_STRING $args;
+ fastcgi_param HTTP_HOST $server_name;
+
+ fastcgi_param GIT_HTTP_EXPORT_ALL "";
+ fastcgi_param GIT_PROJECT_ROOT /srv/git;
+ }
+
+ listen [::]:80 ;
+ listen 80 ;
+ location / {
+ if ($arg_service = git-receive-pack) {
+ rewrite (/.*) /git_write/$1 last;
+ }
+
+ if ($uri ~ ^/.*/git-receive-pack$) {
+ rewrite (/.*) /git_write/$1 last;
+ }
+
+ if ($arg_service = git-upload-pack) {
+ rewrite (/.*) /git_read/$1 last;
+ }
+
+ if ($uri ~ ^/.*/git-upload-pack$) {
+ rewrite (/.*) /git_read/$1 last;
+ }
+ }
+
+location ~ /git_read/(.*) {
+ include git-http-backend.conf;
+}
+
+# require auth to upload
+location ~ /git_write/(.*) {
+ auth_basic "Pushing to Git repositories is restricted";
+ auth_basic_user_file /etc/nginx/htpasswd;
+ include git-http-backend.conf;
+}
+
+} \ No newline at end of file