多くのプロバイダでは,会員用のWebスペースとして「http://www.xxxxxx.ne.jp/~xxxx/」などのURLでアクセスできるよう,ユーザーディレクト下にホームページ用のスペースを用意している。
自分が管理するサーバ上でも,ユーザーごとのホームページを開放させたい場合,次のように設定すればよい。
# vi /usr/local/apache/conf/httpd.conf # UserDir: The name of the directory which is appended onto a user's home # directory if a ~user request is received. # <IfModule mod_userdir.c> UserDir public_html </IfModule> # /usr/local/apache/bin/apachectl restart または, # /etc/rc.d/init.d/httpd restart で,Apacheの再起動も忘れずに。 |
各ユーザーのホームディレクトリでは「public_html」ディレクトリを作成する。次のようにパーミッションを755(または705)にしておこう。
$ cd $ mkdir public_html $ chmod 755 public_html |
public_html下でCGIやSSIを使いたい場合には,httpd.confの中で次の2個所を有効にすればよい。上記の「Options ExecCGI」がCGI,下記の「Options Includes」がSSIである。
〜 中略 〜 <Directory "/home/*/public_html/cgi-bin/"> Options ExecCGI </Directory> 〜 中略 〜 AddHandler server-parsed .shtml <Directory "/home/*/public_html"> Options Includes </Directory> |
Copyright © ITmedia, Inc. All Rights Reserved.