標籤:rip 預設 out main 下載 ati 編輯 apache伺服器 get
GitWeb支援多個版本庫,可以對多個版本庫進行瀏覽目錄(包括曆史版本),可以查看檔案內容,查看提交曆史,提供搜尋及 RSS feed支援,也可以提供目錄檔案的打包下載等。可以看https://git.kernel.org/上的GitWeb樣本。 1,使用yum安裝Apache服務(安裝設定檔的預設路徑為/etc/httpd/conf/httpf.conf) yum -y install httpd 2,配置防火牆,開啟80連接埠供用戶端瀏覽 vim /etc/sysconfig/iptables 添加下面的紅色字型的一行: -A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT # Firewall configuration written by system-config-firewall # Manual customization of this file is not recommended. *filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited -A FORWARD -j REJECT --reject-with icmp-host-prohibited 配置完畢之後重啟防火牆service iptables restart 3,啟動Apache服務 service httpd start 返回如下資訊: Starting httpd: httpd: apr_sockaddr_info_get() failed for tong httpd: Could not reliably determine the server‘s fully qualified domain name, using 127.0.0.1 for ServerName 注意:在這裡是可以啟動的,但是報錯,因為Apache伺服器的設定檔中還沒有添加ServerName參數。 4,添加主機名稱並添加到Apache設定檔的ServerName參數中 查看主機名稱命令:hostname 編輯Apache設定檔 vim /etc/httpd/conf/httpd.conf 找到#ServerName www.example.com:80 改成ServerName {hostname}:80 #ErrorLog logs/error_log #注釋此行,添加下面這行 ErrorLog "|rotatelogs /var/log/httpd/error_log%Y%m%d.log 86400 480" #每天單獨產生一個記錄檔 #CustomLog logs/access_log common #注釋此行,添加下面這行 CustomLog "|rotatelogs /var/log/httpd/access_log%Y%m%d.log 86400 480" common #每天單獨產生一個記錄檔 重啟Apache服務 service httpd restart 5,使用yum安裝gitweb,預設安裝路徑為/var/www/git,設定檔路徑為/etc/gitweb.conf yum install gitweb git的配置參照《Git伺服器安裝-SSH協議篇》 編輯gitweb設定檔 vim /etc/gitweb.conf 找到 #our $projectroot = "/var/lib/git"; 改成 $projectroot = "/home/git";#git倉庫的上級目錄,根據自己實際情況來 6,配置Apache
vim /etc/httpd/conf/httpd.conf 最後一行添加如下內容 #配置gitweb<VirtualHost *:80> ServerName gitserver DocumentRoot /var/www/git <Directory /var/www/git > Options ExecCGI +FollowSymLinks +SymLinksIfOwnerMatch AllowOverride All order allow,deny Allow from all AddHandler cgi-script cgi DirectoryIndex gitweb.cgi </Directory></VirtualHost>儲存,重啟Apache服務service httpd restart 7,可能出現的問題 經過上面的配置後,用戶端瀏覽http://serverip ,就可以瀏覽我們配置的所有git倉庫了,如果頁面顯示404 projects found,那麼注意兩個問題: 1,git倉庫以及上級目錄的許可權,755 2,關閉RELinux服務 setenforece
CentOS下配置apache+gitweb