夜叉神峠より間ノ岳、北岳を望む


Date/Time: 2013:09:29 08:36:45
Camera: Panasonic
Model: DMC-LX2
Exporsure Time: 1/400
FNumber: 5.6
Aperture Value: 5.0
Focal Length: 14.4

Close

y2blog » Mac OS X Tips #2-2 Leopardのホームディレクトリ設定(追記-2)

12

21

2007

Mac OS X Tips #2-2 Leopardのホームディレクトリ設定(追記-2)

 Leopardのホームディレクトリ設定(追記:Web共有の設定)


Leopard で個人のホームディレクトリの場所を変更する方法について、以前の記事(Leopardのホームディレクトリ設定、および[追記])で紹介しました.その際にWEB共有で個人のホームディレクトリのコンテンツにアクセスする場合の設定変更について記述するのを忘れていましたので、WEB共有の設定変更について追記しておきます.


Mac OS X 10.5 LeopardのWEB共有は Apache 2 によって実装されていますが、Apache 2の設定ファイルは /etc/apache2 に置かれています.設定ファイルの詳細な中身は各種の文献や本を参照していただくとして、個人のホームディレクトリ上のWEBコンテンツを公開するための設定ファイルは次のようになっています.


まず、/etc/apache2 ディレクトリのファイルリストを見てみましょう. 




sh-3.2# pwd
/etc/apache2
sh-3.2# ls -laR
total 136
drwxr-xr-x   9 root  wheel    306 Dec 20 23:06 .
drwxr-xr-x  88 root  wheel   2992 Dec 20 10:58 ..
drwxr-xr-x  13 root  wheel    442 Sep 24 10:11 extra
-rw-r--r--   1 root  wheel  17612 Dec 20 23:06 httpd.conf
-rw-r--r--   1 root  wheel  12958 Sep 24 10:11 magic
-rw-r--r--   1 root  wheel  28782 Sep 24 10:11 mime.types
drwxr-xr-x   4 root  wheel    136 Sep 24 10:11 original
drwxr-xr-x   4 root  wheel    136 Sep 24 10:12 other
drwxr-xr-x   5 root  wheel    170 Dec 20 22:24 users



Apache 2 の大元の設定ファイルは “httpd.conf” で、この中でユーザのホームディレクトリに置かれているWEBコンテンツにアクセスする設定箇所があります.



# User home directories
Include /private/etc/apache2/extra/httpd-userdir.conf



という部分で、この設定から “extra”ディレクトリにある “httpd-userdir.conf” というファイルをインクルード(読み込み)するようになっています.


この “httpd-userdir.conf” というファイルの中身を見ると、



# Settings for user home directories
#
# Required module: mod_userdir

#
# UserDir: The name of the directory that is appended onto a user's home
# directory if a ~user request is received.  Note that you must also set
# the default access control for these directories, as in the example below.
#
UserDir Sites

#
# Users might not be in /Users/*/Sites, so use user-specific config files.
#
Include /private/etc/apache2/users/*.conf



ユーザのWEBコンテンツの置き場所のディレクトリ(フォルダー)の名前は、”Sites” (日本語環境ではファインダー上では『サイト』という名前で表示されていますが、Apache からはあくまでも “Sites” というディレクトリ名ですので、”サイト” とはしないで下さい)で、 “users” ディレクトリ下に “xxxxx.conf” (xxxxxはアカウント名)という名前で作成されている個人別の設定ファイルを読み込むようになっています.


“xxxxx.conf” ファイルの中身は、



<Directory "/Users/xxxxx/Sites/">        <===  ここを自分のホームディレクトリに合わせて変更する
    Options Indexes MultiViews
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>


のようになっていますので、<Directory "/Users/xxxxx/Sites/">  の部分を自分のホームディレクトリの絶対パスに合わせて下さい.

 

これで、今までと同じように "http://ホスト名/~xxxxxx/" で個人のホームディレクトリに置かれているWEBコンテンツに正常にアクセスできるようになります.
尚、ホスト名の部分は、192.168.xxx.yyy のようなそのマシンのIPアドレスかDNS名(あるいはBonjour 名)です.同じマシンからアクセスする場合には単純に "http://localhost/~xxxxx/" で良いでしょう.

Calendar

April 2024
S M T W T F S
 123456
78910111213
14151617181920
21222324252627
282930  
  • Blogroll

  • Meta