一. httpd介绍

web服务器, 可以响应静态请求, 支持模块扩展(tomcat).

  • 配置文件位置: /etc/httpd/conf/httpd.conf

  • 日志位置: /etc/log/httpd/

httpd配置(待添加)

二. 搭建git服务端

git仓库端, 编辑.git/config配置文件, 添加

  1. [http]
  2. receivepack = true

httpd, 编辑httpd.conf, 添加

  1. <VirtualHost *:80>
  2. ServerName git.ushare.org
  3. SetEnv GIT_HTTP_EXPORT_ALL
  4. SetEnv GIT_PROJECT_ROOT /data/ushare
  5. ScriptAlias /git/ /usr/libexec/git-core/git-http-backend/
  6. <Location />
  7. AuthType Basic
  8. AuthName "Git"
  9. AuthUserFile /var/www/git-auth
  10. Require valid-user
  11. </Location>
  12. </VirtualHost>

创建软连接

  1. ln -s /data/ushare /var/www/ushare

生成密码

  1. htpasswd -c git-auth user

重启httpd服务, 测试

  1. git clone http://user:pwd@localhost/git/config-repo