As you've seen in my previous post, there's been some package updates in the EL6 Extras
repository, so let's have some fun with them!
First you indeed need my EL6 Extras
repository if it's not done yet, please start with the repositories page.
Install the packages
Now that you're good with the repository, install the packages:
# yum -y install nginx uwsgi cgit
Configure Cgit
The default config from the package is pretty sane, the only thing you'll need to add to your /etc/gitrc
- And indeed your Git
repositories config - is:
virtual-root=/
This will keep cgit
from adding cgit.cgi
to your URL.
To enable syntax highlighting, uncomment the following line in your /etc/cgitrc
source-filter=/usr/libexec/cgit/filters/syntax-highlighting.py
Then install pygments
package
# yum -y install python-pygments
Configure Uwsgi
Just add this simple conf
# mkdir /etc/uwsgi
# cat << EOF > /etc/uwsgi/cgit.ini
[uwsgi]
socket = 127.0.0.1:8080
uid = cgit
gid = cgit
processes = 1
threads = 2
cgi = /usr/libexec/cgit/cgit.cgi
EOF
There's no init script provided in my package yet, so just manually run - or any way you want
# uwsgi --ini /etc/uwsgi/cgit.ini &
Configure Nginx
Finally just add this simple server
block to your Nginx config and customize it to your needs
server {
# Change this to your taste
listen 80 default_server;
server_name _;
# We want to serve cgit static content from /usr/share/cgit and let Nginx cache it
location ~* ^.+(cgit.(css|png)|favicon.ico) {
root /usr/share/cgit;
expires 30d;
}
# Now forward everything else to our uwsgi instance
location / {
include uwsgi_params;
uwsgi_modifier1 9;
uwsgi_pass 127.0.0.1:8080;
}
}
Start Nginx, and enjoy your Cgit
running on your server_name
As usual, contact me if you have any question.