はじめての自宅サーバ構築 - Fedora/CentOS - Last Update 2008/07/25
It opened to 2004/09/19.
当サイトはFedora9で運用しています
Visitors
Pageviews
Today(IP/PV)
3,374,115
12,762,045
1,273/8,667

■ TIPS集『Webサーバ(Apache)』

 ユーザホームページを公開するには?(その1:"~"チルダ付き)

ISPなどの一般のホームページ「http://・・・/~xxx」の様に一般ユーザのホームページを公開する事も可能です。
一般ユーザのホームディレクトリ配下「public_html」を公開します

apacheの設定ファイル「/etc/httpd/conf/httpd.conf」の以下の行を追加・修正します。

# vi /etc/httpd/conf/httpd.conf
<IfModule mod_userdir.c>
  #
  # UserDir is disabled by default since it can confirm the presence
  # of a username on the system (depending on home directory
  # permissions).
  #
  コメントアウトする
  #UserDir disable

  #
  # To enable requests to /~user/ to serve the user's public_html
  # directory, remove the "UserDir disable" line above, and uncomment
  # the following line instead:
  #
  公開するユーザのパス
  UserDir public_html
</IfModule>

ユーザパスの「public_html」をapacheでアクセスできる様にする
以下は「.htaccess」を有効、SSI・CGI実行の許可に設定
<Directory /home/*/public_html>
  AllowOverride All
  Options Includes ExecCGI FollowSymLinks
  Order allow,deny
  Allow from all
</Directory>


修正した後は、apacheを再起動してください。
# /etc/rc.d/init.d/httpd reload


「一般ユーザのホームディレクトリに「public_html」を作成します。
例)一般ユーザ名「linux」のホームページを公開する場合。
 ※:一般ユーザであることに注意して下さい。(カレントパスも「/home/linux」です)
「public_html」パスを作成
$ mkdir public_html
パーミッション「other」が読み取れる様にする
$ chmod 701 /home/linux
実行権を付与する
$ chmod 755 /home/linux/public_html


作成した「public_html」に適当なHTMLを作成し「http://・・・・/~linux/」でアクセス出来るようになります。
ページ先頭へ

Copyright(©)2004-2008 First home server construction. All Right Reserved.