Debian配置cgit

来源:互联网 发布:销售新人被辞退 知乎 编辑:程序博客网 时间:2024/06/05 15:33

本人认为源码中的README有点粗略!


LINUX - cgit - HOW TO INSTALL CGIT ON GITSERVER

HOW TO INSTALL CGIT ON GITSERVER (DEBIAN)
##########################################

THIS GOES OFF THE ARTICLE OF HOW TO SETUP A GITSERVER: http://www.kossboss.com/linux---git---git-server-and-clients-setup

WHAT IS THIS:
CGIT IS A WEB INTERFACE FOR THE GIT SERVER YOU HAVE. HERE IS AN EXAMPLE OF ONE http://git.zx2c4.com/cgit/
THAT EXAMPLE IS ALSO THE MAIN SITE TO DOWNLOAD THE APP

THIS IS ON DEBIAN

PREQS:
apt-get -y install apache2 # SKIP THIS IF YOU HAVE APACHE
apt-get -y install unzip
apt-get -y install git curl bzip2

NOTE: from now on all commands are begun with #, with exception of things inside the 'CONTENTS:' sections as those are file contents, and anything with # in there is a comment.


NOTE: all of the configs here are for cgit to run off http not https

FIRST METHOD
=============

go to http://git.zx2c4.com/cgit/
get latest cgit version under tag section
get its url

# cd /root/
# wget http://git.zx2c4.com/cgit/snapshot/cgit-0.9.2.zip
# unzip cgit*
# cd cgit*

OR INSTEAD

SECOND METHOD
=============

# git clone git://hjemli.net/pub/git/cgit
# cd cgit
# git submodule init
# git submodule update

OR INSTEAD

THIRD METHOD
============

# git clone git://git.zx2c4.com/cgit
# cd cgit
# git submodule init
# git submodule update


AFTER (FIRST,SECOND,or THIRD METHOD)
===================================

# make get-git
# make
# make install

NOTE IT INSTALLS cgit TO /var/www/htdocs/cgit/ - THE MAIN FILE THERE IS cgit.cgi WHICH IS THE CGI PROGRAM. 

I HAVE DEBIAN SO APACHE2 IS LOCATED AT /etc/apache2 WE NEED TO MAKE A CONFIG FILE INTO THE conf.d FOLDER WHICH IS GOOD FOR MODULE TYPE OF APACHE CONFIG (MODULE BASICALLY YOU CAN TAKE IT ON AND OFF, IT DOESNT HAVE TO BE PART OF THE MAIN APACHE CONFIG FILE - EVERYTHING INSIDE THE conf.d FOLDER IS INCLUDED BECAUSE OF apache2.conf) - NOTE IT DOESNT EXIST AT FIRST, THE VI COMMAND MAKES IT

vi /etc/apache2/conf.d/cgit

CONTENTS:

<Directory /var/www/htdocs/cgit>
  AllowOverride None
  Options +ExecCGI
  AddHandler cgi-script .cgi
  Order allow,deny
  Allow from all
  DirectoryIndex cgit.cgi
</Directory>
# Alias /cgit.png /var/www/htdocs/cgit/cgit.png
# Alias /cgit.css /var/www/htdocs/cgit/cgit.css
# Alias /cgit /var/www/htdocs/cgit/cgit.cgi/
Alias /cgit /var/www/htdocs/cgit/

END OF CONTENTS (DONT INCLUDE THIS LINE)

NOTE I DIDNT USE LOTS OF THE ALIASES I SAW ON THE OTHER TUTORIALS, THOSE DIDNT WORK FOR ME

NOW MY cgit CONFIG FILE WHICH IS CALLED /etc/cgitrc - NOTE IT DOESNT EXIST AT FIRST, THE VI COMMAND MAKES IT

vi /etc/cgitrc

CONTENTS:

# cgit config
css=/cgit/cgit.css
logo=/cgit/cgit.png
# if you don't want that webcrawler (like google) index your site
robots=noindex, nofollow
## and included like this:
## include=/etc/cgitrepos
repo.url=hr-git
repo.path=/opt/git/hr
repo.desc=human readable
repo.owner=boss@kossboss.com
# if had another module - it would be added like so
# repo.url=OSGi-module
# repo.path=/home/git/repositories/OSGi-module.git
# repo.desc=the OSGi-module repository
# repo.owner=foo@bar.com

END OF CONTENTS (DONT INCLUDE THIS LINE)

AFTER THAT LETS RESTART APACHE2

# service apache2 restart; 
 
OR 
 
# /etc/init.d/apache2 restart

NOW ACCESS YOUR WEBSERVER WITH THESE FOLDERS:

URL: www.webserver.com/cgit

ALSO CAN

URL: www.webserver.com/htdoc/cgit

MONITOR APACHE AS YOU TRY TO GO TO 

# tail -f /var/log/apache2/access.log -f /var/log/apache2/error.log




NOTE FOR ME THE LAST PART IS DIFFERENT
#######################################

I access mine like this:

URL: www.mysite.com:50500/cgit 

or

URL: www.mysite.com:50500/htdocs/cgit

My server is configured alittle bit different, it runs on port 50500 so it looks like this. You can use this as a template for your  server if it runs on different ports. So my http (not https) is running on 50500 instead of 80. My https is still running on 443 as i didnt edit it.

NOTE: all of the configs here are for cgit to run off http not https

The main apache2 files are changed in a couple places

CONFIG: /etc/apache2/sites-available/default

and the other one is

CONFIG: /etc/apache2/ports.conf

you will see this has other changes because I have a personal 'secure' folder where I use WebDAV, completely unrelated and can be left out in your config

DEFAULT CONFIG FILE
===================

root@debikos71:/var/www# cat /etc/apache2/sites-available/default
<VirtualHost *:50500>
        ServerAdmin webmaster@localhost

        DocumentRoot /var/www
        <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>
        <Directory /var/www/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                allow from all
        </Directory>
        <Directory /var/www/secure>
                DAV On
        </Directory>
        ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
        <Directory "/usr/lib/cgi-bin">
                AllowOverride None
                Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
                Order allow,deny
                Allow from all
        </Directory>

        ErrorLog ${APACHE_LOG_DIR}/error.log

        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel warn

        CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

PORTS CONFIG FILE
==================

root@debikos71:/var/www# cat /etc/apache2/ports.conf
# If you just change the port or add more ports here, you will likely also
# have to change the VirtualHost statement in
# /etc/apache2/sites-enabled/000-default
# This is also true if you have upgraded from before 2.2.9-3 (i.e. from
# Debian etch). See /usr/share/doc/apache2.2-common/NEWS.Debian.gz and
# README.Debian.gz

NameVirtualHost *:50500
Listen 50500

<IfModule mod_ssl.c>
    # If you add NameVirtualHost *:443 here, you will also have to change
    # the VirtualHost statement in /etc/apache2/sites-available/default-ssl
    # to <VirtualHost *:443>
    # Server Name Indication for SSL named virtual hosts is currently not
    # supported by MSIE on Windows XP.
    Listen 443
</IfModule>

<IfModule mod_gnutls.c>
    Listen 443
</IfModule>

NOT IF YOU WERE CURIOUS AT WHATS INSIDE /opt/git/hr
####################################################

This is where my main git is, this is my 'hr' app im working on

Note this is the folder which start when you init a project on git

# find
.
./hr
./branches
./info
./info/exclude
./description
./objects
./objects/7f
./objects/7f/ec74566bb3160b7719fa5cc80e28b673479cb7
./objects/d0
./objects/d0/9ba3e988b91ae11501f99f813ad651c2e1030f
./objects/f1
./objects/f1/ceac8e6ff903de8433507176f5be16edad5d02
./objects/info
./objects/66
./objects/66/840af05958ece50616fc65e4a1157b5f8e73d4
./objects/0b
./objects/0b/fbd2e1dbe6b1d08a1712bda74c34ea5cba78f8
./objects/0b/1f4a22c2bb175ffbc241e2499dcbe92f2e89c3
./objects/dc
./objects/dc/d640b0d04435595d7b5b0586f900686b1adfb6
./objects/30
./objects/30/f0770924a7b9fc5bc815725b494b97e29e0844
./objects/41
./objects/41/71f204c589959b2d65ad41f1404b7ca709f387
./objects/41/724a62663e3b192089dcdaac982b8451ecf958
./objects/be
./objects/be/41bc93b17b0b0a58ad06c2090a03b8ce64720f
./objects/26
./objects/26/16adcbf1417c5d2bc20226f20aed3a35e521c0
./objects/pack
./objects/ca
./objects/ca/4c0c278887c5ce7adbb9c80919cb86e2836269
./objects/71
./objects/71/60395b2f0a0c22d77865eb8983ddb8ccb16d44
./objects/80
./objects/80/e5659a601126e302fbbf069e27ac111e89ebc5
./objects/47
./objects/47/f79f268c45aa7c4999c67fa1798488bfa2609f
./objects/da
./objects/da/b76c2e891d5d72278221eff360a72bba8f82af
./objects/6e
./objects/6e/2aa0074323d38174558dc800cf36cfa8b443aa
./HEAD
./refs
./refs/heads
./refs/heads/master
./refs/tags
./hooks
./hooks/pre-applypatch.sample
./hooks/commit-msg.sample
./hooks/pre-commit.sample
./hooks/pre-rebase.sample
./hooks/prepare-commit-msg.sample
./hooks/update.sample
./hooks/applypatch-msg.sample
./hooks/post-update.sample
./config
0 0
原创粉丝点击
热门问题 老师的惩罚 人脸识别 我在镇武司摸鱼那些年 重生之率土为王 我在大康的咸鱼生活 盘龙之生命进化 天生仙种 凡人之先天五行 春回大明朝 姑娘不必设防,我是瞎子 承台上预埋桥墩连接钢筋错了怎么办 冲床油缸螺栓拆不下来怎么办 汇款到账银行写错了怎么办 搜狗输入法数字序号超过20怎么办 苹果手机保存的图片变模糊怎么办 微信视频保存到手机变模糊怎么办 自己的位置被别人取代了怎么办 给工厂做半成品老板跑了怎么办 微信变成英文再恢复汉字怎么办 cad中标注尺寸数字太小怎么办 扣扣的钱包手势密码忘记了怎么办 台式电脑带符号的数字打不出怎么办 情侣之间出现看见对方就烦怎么办 电信卡号和联通卡号怎么办情侣号 电脑能登qq但打不开网页怎么办 想跟朋友聊天但对方不理怎么办 刚进婆家门被婆婆欺负怎么办 支付宝的聊天记录被删了怎么办 彩票站买彩票把钱付了没出票怎么办 与异性朋友聊天没话题了怎么办 快递写错地址但已经发货了怎么办 快递写错电话但已经发货了怎么办 微信添加好友功能被限制怎么办 qq号被冻结了限制解封怎么办 被别人强制拉入qq群怎么办 qq群里的图片过期了怎么办 q附近人不能关注不能发信息怎么办 qq畅聊之火掉了怎么办 打印机打印时上面空白留太多怎么办 发短信一直空格里面写0怎么办 网贷获取我新手机号通讯录怎么办 系统音频驱动异常或未安装怎么办 附近功能已屏蔽你的qq好友怎么办 新申请的qq号忘了怎么办 刚申请的qq号忘了怎么办 以前申请的qq号忘了怎么办 小孩玩手机游戏扣费了怎么办 手机qq好友头像显示不出来怎么办 qq的一些重要数据被清理怎么办 华为p9微信听筒声音小怎么办 win10我的电脑图标没了怎么办