Chinaunix首页 | 论坛 | 博客
  • 博客访问: 711020
  • 博文数量: 160
  • 博客积分: 8847
  • 博客等级: 中将
  • 技术积分: 1656
  • 用 户 组: 普通用户
  • 注册时间: 2010-11-25 16:46
个人简介

。。。。。。。。。。。。。。。。。。。。。。

文章分类

全部博文(160)

文章存档

2015年(1)

2013年(1)

2012年(4)

2011年(26)

2010年(14)

2009年(36)

2008年(38)

2007年(39)

2006年(1)

分类: 系统运维

2007-04-09 17:10:42

NameVirtualHost 10.12.96.131:80

    ServerName  marketfx.rakuten-sec.co.jp
    ServerAlias marketfx.rakuten-sec.co.jp
    ErrorLog logs/10.12.96.131-error_log
    CustomLog "|/usr/local/apache2/bin/rotatelogs /usr/local/apache2/logs/10.12.96.131.%Y%m%d 86400 540" combined
    DocumentRoot /usr/local/apache2/htdocs
   
        Options Indexes FollowSymLinks MultiViews 
        AllowOverride None
        Order allow,deny
        Allow from all
   

 
NameVirtualHost 10.9.30.11:80

    ServerName  locahost
    ServerAlias 10.9.30.11
    ErrorLog /usr/local/apache2/logs/10.12.96.131
    CustomLog "|/usr/local/apache2/bin/rotatelogs /usr/local/apache2/logs/10.12.96.131.%Y%m%d 86400 540" combined
    DocumentRoot /usr/local/apache2/htdocs
   
        Options FollowSymlinks
        Order allow,deny
        Allow from all
   

    RewriteEngine On
    #RewriteCond %{REMOTE_HOST}  ^10.*
    RewriteCond %{REMOTE_HOST}  !^10.11.31.131
    RewriteRule ^/(.*)$ /usr/local/apache2/htdocs/test/mente_daily.html [L]
 
NameVirtualHost 10.9.30.11:80

    ServerName  locahost
    ServerAlias 10.9.30.11 
    ErrorLog /usr/local/apache2/logs/10.12.96.131
    CustomLog "|/usr/local/apache2/bin/rotatelogs /usr/local/apache2/logs/10.12.96.131.%Y%m%d 86400 540" combined
    DocumentRoot /usr/local/apache2/htdocs
   
        Options FollowSymlinks
        Order allow,deny
        Allow from all
   

    RewriteEngine On
    #RewriteCond %{REMOTE_HOST}  ^10.*
    RewriteCond %{REMOTE_HOST}  !^10.11.31.131
    RewriteRule ^/(.*)$ /usr/local/apache2/htdocs/test/mente_emergency.html [L]
 
切换脚本:
#!/bin/sh
#This is used to Switch apache page for (daily/emergency/default)
Apache_dir="/usr/local/apache2";
BIN_dir="/usr/local/apache2/bin";
CONF_dir="/usr/local/apache2/conf";
Switch_default()
{
        echo "Now,Apache will switch default page..."
        sleep 2;
        mv $CONF_dir/httpd.conf $CONF_dir/httpd.conf.bak;
        cp $CONF_dir/extra/httpd.conf $CONF_dir/httpd.conf;
        $BIN_dir/apachectl restart;
}
Switch_e()
{
        echo "Now,Apache will switch emergency page...";
        sleep 2;
        mv $CONF_dir/httpd.conf $CONF_dir/httpd.confd.bak;
        cp $CONF_dir/extra/httpd.conf.mente_emergency $CONF_dir/httpd.conf;
        $BIN_dir/apachectl restart;
}
Switch_d()
{
        echo "Now,Apache will be switched daily page..."
        sleep 2;
        mv $CONF_dir/httpd.conf $CONF_dir/httpd.conf.bak;
        cp $CONF_dir/httpd.conf.mente_daily $CONF_dir/httpd.conf;
        $BIN_dir/apachectl restart;
}
        case "$1" in
                e)
                        Switch_e
                        Result_=$?;
        ;;
                d)switch daily;
                        Switch_d;
                        Result_=$?;
        ;;
                default) switch default;
                        Switch_default;
                        Result_=$?;
        ;;
        *)
                echo
                echo "Usge: switch_apache.sh [default | e | d]";
                echo
                echo "-------------switch-------------"
                echo "1) default:default page"
                echo "2) e:emergency page";
                echo "3) d:daily page";
                echo " --------------------------------";
                exit 1;
        esac
        if [ "$Result_" = "0" ]
        then
                echo "Switch is sucessful!";
        else
                mv $CONF_dir/httpd.conf.bak $CONF_dir/httpd.conf;
                $BIN_dir/apachectl restart;
                echo "Error:Not Switch";
        fi
阅读(1816) | 评论(1) | 转发(0) |
给主人留下些什么吧!~~