OpenBSD部署CGit

#OpenBSD  #Git

CGit

cgitrc

footer=/home/www/conf/cgit.footer

# Enable caching of up to 1000 output entries
# cache-size=1000

# cache-root=/home/www/cgit/cache

# Specify some default clone urls using macro expansion
clone-url=git://astrologer.cc:8005/$CGIT_REPO_URL

# Specify the css url
css=/cgit.css

# Show owner on index page
enable-index-owner=0

# Allow http transport git clone
enable-http-clone=1

# Show extra links for each repository on the index page
enable-index-links=0

# Enable ASCII art commit history graph on the log pages
enable-commit-graph=1

# Show number of affected files per commit on the log pages
enable-log-filecount=1

# Show number of added/removed lines per commit on the log pages
enable-log-linecount=1

# Sort branches by date
branch-sort=age

# Add a cgit favicon
#favicon=/favicon.ico

# Enable statistics per week, month and quarter
max-stats=quarter

# Set the title and heading of the repository index page
root-title=Astrologer Repositories

# Set a subheading for the repository index page
root-desc=

# Allow download of tar.gz, tar.bz2 and zip-files
snapshots=tar.gz

## List of common mimetypes
mimetype.gif=image/gif
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

## Search for these files in the root of the default branch of repositories
## for coming up with the about page:
readme=:README.md
about-filter=/home/www/scripts/md2html.sh

virtual-root=/

scan-path=/home/www/gitrepos/

# Disable adhoc downloads of this repo
repo.snapshots=0

# Disable line-counts for this repo
repo.enable-log-linecount=0

# Restrict the max statistics period for this repo
repo.max-stats=month

httpd.conf

server "cgit" {
    listen on 127.0.0.1 port 8084
    location "/cgit*" {
        root "/cgit/"
        no fastcgi
    }

    location "/*" {
        root "/home/www/cgi-bin/cgit.cgi"
        fastcgi socket "/run/slowcgi.sock"
        fastcgi param  "CGIT_CONFIG" "/home/www/conf/cgitrc"
    }
}

nginx.conf

server {
    listen       443 ssl;
    server_name  git.astrologer.cc;

    ssl_certificate      /etc/ssl/server.crt;
    ssl_certificate_key  /etc/ssl/private/server.key;

    ssl_session_timeout  5m;
    ssl_session_cache    shared:SSL:1m;

    ssl_ciphers  HIGH:!aNULL:!MD5:!RC4;
    ssl_prefer_server_ciphers   on;
    location / {
        proxy_set_header Host $http_host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header Upgrade $http_upgrade;
        proxy_redirect off;
        proxy_buffering off;
        proxy_pass http://127.0.0.1:8084;
    }
}

slowcgi

/usr/sbin/slowcgi -s /home/www/run/slowcgi.sock -p /

md2html.sh

#!/bin/sh

# This may be used with the about-filter or repo.about-filter setting in cgitrc.
# It passes formatting of about pages to differing programs, depending on the usage.

# Markdown support requires python and markdown-python.
# RestructuredText support requires python and docutils.
# Man page support requires groff.

# The following environment variables can be used to retrieve the configuration
# of the repository for which this script is called:
# CGIT_REPO_URL        ( = repo.url       setting )
# CGIT_REPO_NAME       ( = repo.name      setting )
# CGIT_REPO_PATH       ( = repo.path      setting )
# CGIT_REPO_OWNER      ( = repo.owner     setting )
# CGIT_REPO_DEFBRANCH  ( = repo.defbranch setting )
# CGIT_REPO_SECTION    ( = section        setting )
# CGIT_REPO_CLONE_URL  ( = repo.clone-url setting )

exec /usr/local/bin/lowdown

git

mkdir xxx.git
cd xxx.git
git init --bare
vim description