android代码版本管理-gitweb安装

前言

Gitweb提供了git版本库的图形化web浏览功能。可以到网站http://git.kernel.org/体验下效果

安装系统 Ubuntu 18.04

安装apach2

sudo apt-get install apache2

安装gitweb

sudo apt-get install gitweb

配置修改

sudo vi /etc/apache2/httpd.conf

#<IfModule mod_ssl.c> #开启ssl时开启
<VirtualHost *:8082>  #开启ssl时改为443
  ServerName 192.168.x.xxx #本机ip
  DocumentRoot /home/git/review_site/git

  # Deny to access to .htaccess etc
  <Files ~ "(^\.htaccess|^.*\.conf)">
    Order allow,deny
    Deny from all
  </Files>

  # OPTIONAL: Completely deny pushing over HTTP
  # <LocationMatch "git-receive-pack">
  #   Order Allow,Deny
  #   Deny from all
  # </LocationMatch>

  <Directory /usr/share/gitweb>
    Options ExecCGI FollowSymLinks
    Order allow,deny
    Allow from all
  </Directory>

  <Location />
    AuthType Basic
    AuthName "Git Repositories"
    AuthUserFile /home/git/review_site/etc/web_passwords
    #Require valid-user #开启登录用户验证时开启
    Order allow,deny
    Allow from all
  </Location>

  Options ExecCGI FollowSymLinks
  AddHandler cgi-script cgi

  SetEnv GIT_PROJECT_ROOT /git
  SetEnv GIT_HTTP_EXPORT_ALL

  # Note: Serve static files directly
  AliasMatch ^/static/(.*)$                                    /usr/share/gitweb/static/$1
  AliasMatch ^/(.*/objects/[0-9a-f]{2}/[0-9a-f]{38})$          /git/$1
  AliasMatch ^/(.*/objects/pack/pack-[0-9a-f]{40}.(pack|idx))$ /git/$1
  # Note: Serve repository objects with Git HTTP backend 
  ScriptAliasMatch \
    "(?x)^/(.*/(HEAD | \
      info/refs | \
      objects/info/[^/]+ | \
      git-(upload|receive)-pack))$" \
    /usr/lib/git-core/git-http-backend/$1
  ScriptAlias / /usr/share/gitweb/gitweb.cgi

  RewriteEngine on
  RewriteRule ^/$ /usr/share/gitweb/gitweb.cgi [L]
  RewriteRule ^/(\w+\.git)$  /?p=$1 [R]

  ErrorLog ${APACHE_LOG_DIR}/git_error.log
  CustomLog ${APACHE_LOG_DIR}/git_access.log combined

#开启ssl时开启,git.service.com改为秘钥所在文件夹,git.service.com或service.com都有可能
#SSLCertificateFile /etc/letsencrypt/live/git.service.com/fullchain.pem
#SSLCertificateKeyFile /etc/letsencrypt/live/git.service.com/privkey.pem
#Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>
#</IfModule>

sudo vi /etc/apache2/apache2.conf

Include httpd.conf

sudo vi /etc/apache2/ports.conf

Listen 8082 //这里的8082端口号是上面配置的Apache2反射端口

开启SSL、Proxy、Rewrite等模块:

cd /etc/apache2/mods-enabled

在这个路径下面,输入下面的命令

sudo ln -s ../mods-available/proxy.load
sudo ln -s ../mods-available/proxy.conf
sudo ln -s ../mods-available/proxy_http.load
sudo ln -s ../mods-available/proxy_balancer.conf
sudo ln -s ../mods-available/proxy_balancer.load
sudo ln -s ../mods-available/rewrite.load
sudo ln -s ../mods-available/ssl.conf
sudo ln -s ../mods-available/ssl.load
sudo ln -s ../mods-available/slotmem_shm.load
sudo ln -s ../mods-available/socache_shmcb.load

重启apach2即可

sudo /etc/init.d/apache2 restart

最后浏览器输入

http://192.168.x.xxx:8082/

在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值