Skip to content

Instantly share code, notes, and snippets.

@beheadedmyway
Created January 2, 2012 08:12
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save beheadedmyway/1549832 to your computer and use it in GitHub Desktop.
Save beheadedmyway/1549832 to your computer and use it in GitHub Desktop.
Gitweb on Centos behind Nginx with init script.
#!/bin/bash
#
# gitweb
#
# chkconfig: 235 20 80
# description: start and stop gitweb
# processname: gitweb
# pidfle: /var/run/gitweb.pid
# Source function library.
. /etc/rc.d/init.d/functions
PROG=gitweb
PID=/var/run/gitweb.pid
case "$1" in
start)
echo -n "Starting $PROG services"
export FCGI_SOCKET_PATH=127.0.0.1:9002
nohup /var/www/nginx/cgi-bin/gitweb/gitweb.fcgi < /dev/null > /dev/null 2>&1 &
echo ""
;;
stop)
echo -n "Shutting down $PROG services: "
pkill -9 -f gitweb
echo ""
;;
restart)
echo -n "Restarting $PROG services: "
stop
start
;;
*)
echo "Usage: <servicename> {start|stop|restart}"
exit 1
;;
esac
server {
listen 80;
server_name git.MYSITE.com;
location / {
index gitweb.fcgi
root /var/www/nginx/cgi-bin/gitweb;
include /etc/nginx/fastcgi_params;
fastcgi_pass 127.0.0.1:9002;
}
location /static {
root /var/www/nginx/cgi-bin/gitweb/;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment