Installing spawn-fcgi
To start out with, we need to install the Nginx and the other dependencies.
apt-get install nginx fcgiwrap git
Ok, here we go, lets start out by creating a place to play with source, I always build in /var/src/ but your welcome to do this anywhere you wish.
/etc/sysconfig/spawn-fcgi:
FCGI_SOCKET=/var/run/fcgiwrap.socket FCGI_PROGRAM=/usr/local/sbin/fcgiwrap FCGI_USER=nginx FCGI_GROUP=nginx FCGI_EXTRA_OPTIONS="-M 0700" OPTIONS="-u $FCGI_USER -g $FCGI_GROUP -s $FCGI_SOCKET -S $FCGI_EXTRA_OPTIONS -F 1 -P /var/run/spawn-fcgi.pid -- $FCGI_PROGRAM"
Configuring Nginx
server { listen 80; server_name code.example.com; root /var/www/code.example.com; fastcgi_param DOCUMENT_ROOT /var/www/code.example.com; rewrite ^/secure/ https://code.example.com$request_uri permanent; location /cgit.css { expires 180d; } location /code-logo.png { expires 180d; } location /robots.txt { expires 180d; } # Serve static files location ~* ^.+.(css|png|ico)$ { root /var/www/code.example.com; expires 30d; } location / { #rewrite ^/([^?/]+/[^?]*)?(?:?(.*))?$ /cgit?url=$1&$2 last; include "fastcgi_params"; fastcgi_pass unix:/var/run/spawn-fcgi.socket; fastcgi_index /; fastcgi_param SCRIPT_FILENAME /var/www/code.example.com/cgit.cgi; fastcgi_param PATH_INFO $uri; fastcgi_param QUERY_STRING $args; } }cgit Installed on a Ubuntu Nginx Server is a post from; Matt's Technology Blog which is not allowed to be copied on other sites.