モンスターカレンダー

« 2010年8月
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31

環境設定の最近のブログ記事

サイトメンテナンス中は、メンテ中画面を単に表示しているだけだったが、ステータス503を返しておくのがよいとのこと。

メンテナンス中画面を出す正しい作法と.htaccessの書き方

.htaccessに以下のように書けばOK。

ErrorDocument 503 /maintenance.html

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_URI} !=/maintenance.html
RewriteRule ^.*$ - [R=503,L]
</IfModule>

これは簡単。と適用してみると500エラーになってしまう。
エラーログには「RewriteRule: invalid HTTP response code for flag 'R'」と出ている。
調べてみると「RewriteRuleでR=503を指定するのは2.2系でしか使えない」だそうだ。上述のページのコメント欄に指摘があり、今回対象のサーバは使えないようだ...

メンテナンス画面を表示させる方法(Apache 1.3対応版)

上記の設定でようやくOK。

●503を返す503.phpを作成。
<?php
header ('HTTP/1.0 503 Service Temporarily Unavailable');
include(dirname(__FILE__) . '/index.html');
?>
●.htaccessの設定。

RewriteCond %{REQUEST_URI} !\.css$
RewriteCond %{REQUEST_URI} !\.js$
RewriteCond %{REQUEST_URI} !\.jpg$
RewriteCond %{REQUEST_URI} !\.gif$
RewriteCond %{REQUEST_URI} !\.png$
RewriteCond %{REQUEST_URI} !\.swf$
RewriteCond %{REMOTE_ADDR} !=192.168.0.1 #(管理者のIPアドレス)
RewriteCond %{REQUEST_FILENAME} !503.php
RewriteRule ^.*$ /maintenance/503.php [R,L]

ほんの10分で済む予定が1時間かかってしまいました。。

以下を使用させていただくことにした。

バックアップスクリプト

実行すると...PerlのDate-Calcモジュールがない!と言われてしまった。。。
勢いで初Perlインストール。

(1)/etc/ntp.conf へNTPサーバを設定する。
(例)
server ntp2.jst.mfeed.ad.jp

(2)以下を実行。
#service ntpd start
#chkconfig ntpd on

(3)確認。
# chkconfig --list |grep ntp
ntpd 0:オフ 1:オフ 2:オン 3:オン 4:オン 5:オン 6:オフ