CentOS下配置apache+gitweb

來源:互聯網
上載者:User

標籤: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

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.