yum install httpd mod_dav_svn subversion mod_ssl openssl openldaplinux
# mkdir /home/svngit
[root@localhost ~]# svnadmin create /home/svn/project1apache
[root@localhost ~]# svnadmin create /home/svn/project2vim
[root@localhost ~]# cd /home/svn瀏覽器
[root@localhost svn]# ll服務器
總用量 0svn
drwxr-xr-x. 6 root root 80 6月 27 20:11 project1gitlab
drwxr-xr-x. 6 root root 80 6月 27 20:11 project2測試
[root@localhost svn]# cp project1/conf/authz ./ui
[root@localhost svn]# vim authz
配置權限
[/]
admin = rw
[project1:/]
user1 = rw
[project2:/]
user2 = rw
修改svnserve.conf
[root@localhost svn]# vim project1/conf/svnserve.conf
在general加入以下兩行
[general]
anon-access = none
auth-access = write
拷貝此文件到project2
生成密碼文件
[root@localhost svn]# htpasswd -cm passwd admin
目錄權限更改
[root@localhost svn]# chown -R apache.apache /home/svn
apache配置
一、http.conf
[root@localhost svn]# vim /etc/httpd/conf/httpd.conf
在底部增長以下配置
ServerName localhost:80
LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so
<Location /project1>
DAV svn
SVNPath /home/svn/project1
SSLRequireSSL
AuthType Basic
AuthName "Subversion for project1"
AuthUserFile /home/svn/passwd
AuthzSVNAccessFile /home/svn/authz
Satisfy all
Require valid-user
</Location>
<Location /project2>
DAV svn
SVNPath /home/svn/project2
SSLRequireSSL
AuthType Basic
AuthName "Subversion for project2"
AuthUserFile /home/svn/passwd
AuthzSVNAccessFile /home/svn/authz
Satisfy all
Require valid-user
</Location>
二、配置https訪問
生成私鑰
[root@localhost svn]# cd /etc/httpd/conf
[root@localhost conf]# openssl genrsa -out httpd.key 1024
用前面生成的私鑰生成證書
[root@localhost conf]# openssl req -new -key httpd.key -out httpd.pem -days 3650 -x509
修改Apache的SSL配置文件
[root@localhost conf.d]# vim /etc/httpd/conf.d/ssl.conf
註釋以下2個字段
在底部添加三行
ServerName localhost:443
SSLCertificateFile /etc/httpd/conf/httpd.pem
SSLCertificateKeyFile /etc/httpd/conf/httpd.key
[root@localhost conf.d]# lsof -i:80
或者
[root@localhost conf.d]# netstat -apn|grep 80
查看端口80 佔用狀況
關閉gitlab服務
重啓httpd服務
[root@localhost conf.d]# systemctl restart httpd
查看日誌
[root@localhost conf.d]# tail -f /etc/httpd/logs/ssl_error_log
瀏覽器打開 https://172.30.68.227
若apache服務啓動正常,會顯示以下測試頁面
訪問project1 輸入admin
錯誤提示
查看日誌
修改passwd權限
重啓服務後,查看日誌
仍然報錯,關掉selinux便可
[root@localhost ~]# vim /etc/sysconfig/selinux
重啓服務器