码迷,mamicode.com
首页 > Web开发 > 详细

快速搭建内网测试网络,简单模拟WEB集群

时间:2018-06-09 11:34:07      阅读:457      评论:0      收藏:0      [点我收藏+]

标签:comm   upstream   目录   str   location   不同   name   .com   lis   

模拟WEB集群

后端WEB集群192.168.1.231:8080和192.168.1.232:8080.WEB后端可以按照需要增加,不同目录启动不同端口,通过使用192.168.1.231:80作为负载均衡访问.

upstream  www.front.com
{
    server   192.168.1.232:8080;
    server   192.168.1.231:8080;
}

server
{
    listen  80;
    server_name  192.168.1.231;

    location / {
        proxy_pass        http://www.front.com;
        proxy_set_header   Host             $host;
        proxy_set_header   X-Real-IP        $remote_addr;
        proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
    }
}
SVN自动发布

使用SVN提交时,注释中输入"auto_deploy",自动发布到231,232的项目测试服务器.svn钩子文件post-commit

#!/bin/bash

REPOS="$1"
REV="$2"
if ( svnlook log -r $REV /data/www/svn/gtl/ |grep "auto_deploy" )
then

    echo "`date` auto_deploy">> /tmp/testsvn.log
#front1
    ssh root@192.168.1.231 ‘svn update /data/wwwroot/gtl/ --username "sylar" --password "gtl1023"‘
    ssh root@192.168.1.231 ‘chown www.www -R /data/wwwroot/gtl‘

#front2
    ssh root@192.168.1.232 ‘svn update /data/wwwroot/gtl/ --username "sylar" --password "gtl1023"‘
    ssh root@192.168.1.232 ‘chown www.www -R /data/wwwroot/gtl‘

#admin
    ssh root@192.168.1.232 ‘svn update /data/wwwroot/admin/ --username "sylar" --password "gtl1023"‘
    ssh root@192.168.1.232 ‘chown www.www -R /data/wwwroot/admin‘

fi
另外一个SVN钩子,强制SVN提交时输入注释
#!/bin/sh
REPOS="$1"
TXN="$2"
SVNLOOK=/usr/bin/svnlook
LOGMSG=$($SVNLOOK log -t "$TXN" "$REPOS" | grep "[a-zA-Z0-9]" | wc -c)
if [ "$LOGMSG" -lt 10 ]; then
echo -e "\n 提交文件时必须添加注释,提交中止."1>&2
exit 1
fi

快速搭建内网测试网络,简单模拟WEB集群

标签:comm   upstream   目录   str   location   不同   name   .com   lis   

原文地址:https://www.cnblogs.com/ops-sylar/p/9158768.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!