Skip to content

Instantly share code, notes, and snippets.

@ankitrgadiya
Last active February 13, 2024 07:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save ankitrgadiya/29561925b60f9efd00952f8b21fbd0b5 to your computer and use it in GitHub Desktop.
Save ankitrgadiya/29561925b60f9efd00952f8b21fbd0b5 to your computer and use it in GitHub Desktop.
Cgit configurations
# Apache Conf
# Mod cgi required for cgi script
<VirtualHost *:80>
ServerName locahost
# ServerAdmin webmaster@localhost
DocumentRoot "/usr/share/cgit"
<Directory "/usr/lib/cgit/">
AllowOverride None
Require all granted
</Directory>
Alias /cgit-css "/usr/share/cgit/"
ScriptAlias / "/usr/lib/cgit/cgit.cgi"
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
# Ankit's CGIT config
# Order of the configuration options is important.
virtual-root=/ # Required for Nginx
css=/cgit.css
logo=/avatar.svg
footer=
source-filter=/usr/lib/cgit/filters/syntax-highlighting.sh
root-title=Repositories
root-desc=
noplainemail=1
clone-prefix=https://git.example.com
# Enable snapshots
snapshots=tar.gz zip
# Disable owner index
enable-index-owner=0
mimetype.git=image/git
mimetype.html=text/html
mimetype.jpg=image/jpeg
mimetype.jpeg=image/jpeg
mimetype.pdf=application/pdf
mimetype.png=image/png
mimetype.svg=image/svg+xml
# Caching
cache-dynamic-ttl=60
cache-static-ttl=44640
cache-root-ttl=6
cache-repo-ttl=120
# Note: For cgit to automatically look
# in the directory for git repositories
# scan-path=/git
# Section1
section=Section 1
# Project 1
repo.url=section1/project1.git
repo.path=/git/section1/project1.git
repo.desc=Project 1 Description
# Project 2
repo.url=section1/project2.git
repo.path=/git/section1/project2.git
repo.desc=Project 2 Description
# Section2
section=Section 2
# Project 1
repo.url=section2/project1.git
repo.path=/git/section2/project1.git
repo.desc=Project 1 Description
# Project 2
repo.url=section2/project2.git
repo.path=/git/section2/project2.git
repo.desc=Project 2 Description
# NGINX configuration
# Fcgiwrap required for cgi script
server {
listen 80 default_server;
# SSL
# listen 443 ssl;
# ssl_certificate /etc/nginx/certs/final.crt;
# ssl_certificate_key /etc/nginx/certs/private.key;
server_name localhost;
index cgit.cgi;
root /usr/share/webapps/cgit;
try_files $uri @cgit;
location @cgit {
fastcgi_param SCRIPT_FILENAME /usr/share/webapps/cgit/cgit.cgi;
fastcgi_param PATH_INFO $uri;
fastcgi_param QUERY_STRING $args;
fastcgi_param HTTP_HOST $server_name;
fastcgi_pass unix:/run/fcgiwrap.socket;
include fastcgi_params;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment