Turbo Linux 7 Server - Apache

Last Modified: 2004.02.18

16. Apacheの設定
従来のコンテンツを利用するため、ディレクトリを/var/wwwから/home/httpdに変更した。

1. /etc/httpd/conf/httpd.confファイルを編集


 ServerName       www.kkoba.com                   <-- これを指定すると、ディレクトリの最後の/を補完する
 ServerType       standalone                      <-- inetdからではなくstandaloneで起動
 ServerAdmin      webmaster@kkoba.com             <-- 管理者のメールアドレス
 ServerTokens     ProductOnly                     <-- Server情報は Apache のみ表示
 ServerSignature  Off                             <-- エラーページ等にバージョン情報を表示しない
 DocumentRoot     "/home/httpd/html"              <-- /var/www.htmlから変更

 <IfModule mod_dir.c>
     DirectoryIndex index.html index.shtml        <-- ファイル名が省略された時はindex.htmlかindex.shtml
 </IfModule>

 <Directory />                                    <-- 全体の設定。配下のディレクトリに継承される。
     Options FollowSymLinks
     AllowOverride None
 </Directory>

 <Directory "/home/httpd/html">                   <-- /var/www.htmlから変更
 #   Options Indexes FollowSymLinks MultiViews    <-- コメント化。FollowSymLinksだけが/から継承される。
     AllowOverride All                            <-- ディレクトリ毎に.htaccessファイルでの制御を可能にする。
     Order allow,deny
     Allow from all
 </Directory>

 Alias /icons/ "/home/httpd/icons/"               <-- 標準の/var/www/icons/から変更
 <Directory "/home/httpd/icons">
 #   Options Indexes MultiViews                   <-- コメント化。FollowSymLinksだけが/から継承される。
     AllowOverride None
     Order allow,deny
     Allow from all
 </Directory>

 ScriptAlias /cgi-bin/ "/home/httpd/cgi-bin/"     <-- 標準の/var/www/cgi-bin/から変更
 <Directory "/home/httpd/cgi-bin">
     Options None
     AllowOverride All                            <-- ディレクトリ毎に.htaccessファイルでの制御を可能にする。
     Order allow,deny
     Allow from all
 </Directory>
上記は、変更した部分と主な部分のみ。

2. ディレクトリの作成


 [root@linux /root]# cd /home
 [root@linux /home]# mkdir httpd
 [root@linux /home]# cd /httpd
 [root@linux /httpd]# mkdir html cgi-bin
 [root@linux /httpd]# mv /var/www/icons .

3. SSIの設定

SSIを利用可能にするために、/home/httpd/htmlに以下の内容で.htaccessファイルを作成する。
SSIについては、とほほのSSI入門を参照。

 Addtype text/x-server-parsed-html .shtml
 Options +Includes

4. Serviceの起動


 [root@linux /root]# /etc/init.d/httpd start    <-- 起動する場合
 [root@linux /root]# /etc/init.d/httpd restart  <-- 再起動する場合


<Prev Top Next>
Copyright(C) 2001-2003 Katsuyuki Kobayashi.
このサイトへのリンクや引用時はメール頂戴
webmaster@kkoba.com