diff options
| author | Ben Sanders <ben@sanders.life> | 2025-12-02 07:30:04 -0500 |
|---|---|---|
| committer | Ben Sanders <ben@sanders.life> | 2025-12-02 07:30:04 -0500 |
| commit | dc565ab2ff86291999f50a5d7d2f7769b11009b4 (patch) | |
| tree | 54cdba7b34f0ec205290413c807ecdfcb3b2603c /cgit.conf | |
| parent | 85c080c74c55e3a1ce19bc4c69aa1a7c0f54f643 (diff) | |
added some chatgpt notes and some of my own
Diffstat (limited to 'cgit.conf')
| -rw-r--r-- | cgit.conf | 56 |
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 |
