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