标签:apache+nginx+svn 自动化发布 svn隐藏真实ip svn自动化部署
ansible+nginx+apache+svn自动化发布(隐藏真实ip以及路径)
一.ansible根据以下网址进行安装
http://blog.51cto.com/8999a/1965139
二.nginx+apache+svn安装
rpm -ivh http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm
yum install httpd subversion mod_dav_svn nginx -y
htpasswd -cm /etc/svn-auth-accounts root
需要新增用户时去掉-c选项即可
mkdir /var/www/svn
cd /var/www/svn
svnadmin create repo
cd /repo/conf
vim svnserve.conf
将注释打开
anon-access = read
auth-access = write
password-db = passwd
authz-db = authz
realm = repo
设置anon-access = none #可以打开查看日志
vim passwd
创建用户密码 我这用的就是上面的root
root = qqqqqq
vim authz
[/]
root = rw
chown -R apache.apache repo/
vim /etc/httpd/conf/httpd.conf
Listen 90
把监听端口改一下 这里改成90
在文件末尾添加
<Location /svn>
DAV svn
SVNParentPath /var/www/svn/
AuthType Basic
AuthName "SVN Repository"
AuthUserFile /etc/svn-auth-accounts
AuthzSVNAccessFile /var/www/svn/repo/conf/authz
Require valid-user
</Location>
/etc/init.d/httpd restart
cd /mnt/
mkdir test
cd test/
touch aaa
touch bbb
touch qqq
cd ..
cd -
svn import -m "FIsasda" /mnt/test/ file:///var/www/svn/repo/test
测试可以直接编辑
vim /etc/nginx/conf.d/default.conf
server {
listen 80 ;
server_name svn.test33.com; #这个填写域名以及解析到你服务器的ip
location / {
proxy_set_header?Host?$host;
proxy_set_header?X-Real-IP?$remote_addr;
#proxy_set_header?X-Forwarded-Proto?https; 没用https所以我这注释了
proxy_set_header?X-Forwarded-For?$proxy_add_x_forwarded_for;
proxy_pass?http://localhost:90; #这个就是反向代理到apache进行处理
}
/etc/init.d/httpd restart
/etc/init.d/nginx restart
输入这个地址就可以进行访问就代表成功部署
http://svn.test33.com/svn/repo/test
ansible要跟svn设置免密钥登陆以及svn要跟需要发布代码的后端服务器进行设置免密钥登陆
ansible设置免密钥
ssh-keygen -t rsa
ssh-copy-id -i ~/.ssh/id_rsa.pub root@svn服务器ip #把公钥拷贝到svn上
svn设置免密钥登陆
ssh-keygen -t rsa
ssh-copy-id -i ~/.ssh/id_rsa.pub root@后端服务器ip #把公钥拷贝到svn上
这些设置好的话,就可以设置自动发布了
标签:apache+nginx+svn 自动化发布 svn隐藏真实ip svn自动化部署
原文地址:http://blog.51cto.com/8999a/2110674