/etc/httpd/conf/httpd.conf の修正個所

太字が項目を、太字赤は変更または追加個所斜体はコメント(コメントはファイルに書かないで下さい)

### Section 1: Global Environment

# Don't give away too much information about all the subcomponents
# we are running. Comment out this line if you don't mind remote sites
# finding out what major optional modules you are running
ServerTokens Prod

# KeepAlive: Whether or not to allow persistent connections (more than
# one request per connection). Set to "Off" to deactivate.
#
KeepAlive On

# MaxKeepAliveRequests: The maximum number of requests to allow
# during a persistent connection. Set to 0 to allow an unlimited amount.
# We recommend you leave this number high, for maximum performance.
#
MaxKeepAliveRequests 1000

### Section 2: 'Main' server configuration

# ServerAdmin: Your address, where problems with the server should be
# e-mailed. This address appears on some server-generated pages, such
# as error documents. e.g. admin@your-domain.com
#
ServerAdmin admin@kaji3.com  <<サーバー管理者のメールアドレス

# ServerName gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify
# 中略
# redirections work in a sensible way.
#
ServerName www.kaji3.com:80  <<デフォルトでのサーバー名

#
# UseCanonicalName: Determines how Apache constructs self-referencing 
# URLs and the SERVER_NAME and SERVER_PORT variables.
# When set "Off", Apache will use the Hostname and Port supplied
# by the client. When set "On", Apache will use the value of the
# ServerName directive.
#
UseCanonicalName On

# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "/home/www-owner/html"  <<バーチャルホストや~USER以外で接続された時に参照するホルダ

# This should be changed to whatever you set DocumentRoot to.
#
#<Directory "/var/www/html">
<Directory "/home/www-owner/html">  <<上記フォルダの設定 特別にCGIをどこでも許可

#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# 中略
# http://httpd.apache.org/docs-2.0/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks ExecCGI  <<特別にCGIをどこでも許可
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# 中略
</Directory>

# UserDir: The name of the directory that is appended onto a user's home
# directory if a ~user request is received.
# 中略
# 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 html
  <<ユーザーディレクトリの利用を許可し、そのフォルダ名をhtmlとする

</IfModule>

# Control access to UserDir directories. The following is an example
# for a site where these directories are restricted to read-only.
# 中略
# </LimitExcept>
#</Directory>

<Directory /home/*/html>  <<ユーザーディレクトリの設定:読み込みのみ。 全行追加
AllowOverride None
Options FollowSymLinks
Order allow,deny
Allow from all
</Directory>

<Directory /home/*/html/cgi-bin>  <<ユーザーディレクトリの下のcgi-binのみCGIを許可。 全行追加
AllowOverride None
Options FollowSymLinks ExecCGI
Order allow,deny
Allow from all
</Directory>


# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
# 中略
# negotiated documents. The MultiViews Option can be used for the 
# same purpose, but it is much slower.
#
DirectoryIndex index.html index.html.var index.htm index.cgi index.php


# Optionally add a line containing the server version and virtual host
# name to server-generated pages (error documents, FTP directory listings,
# mod_status and mod_info output etc., but not CGI generated documents).
# Set to "EMail" to also include a mailto: link to the ServerAdmin.
# Set to one of: On | Off | EMail
#
ServerSignature Off


# ScriptAlias: This controls which directories contain server scripts.
# ScriptAliases are essentially the same as Aliases, except that
# 中略
# Alias.
#
#ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"  <<スクリプトエイリアスを利用しない


# Specify a default charset for all pages sent out. This is
# always a good idea and opens the door for future internationalisation
# 中略
# which encourage you to always set a default char set.
#
#AddDefaultCharset ISO-8859-1

# To use CGI scripts outside of ScriptAliased directories:
# (You will also need to add "ExecCGI" to the "Options" directive.)
#
AddHandler cgi-script .cgi .pl

# To parse .shtml files for server-side includes (SSI):
# (You will also need to add "Includes" to the "Options" directive.)
#
#AddOutputFilter INCLUDES .shtml  <<SSIを利用しない

### Section 3: Virtual Hosts
#
# VirtualHost: If you want to maintain multiple domains/hostnames on your
# 中略
# Use name-based virtual hosting.
#
NameVirtualHost 192.168.1.222  <<サーバーのIPアドレス

# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# 中略
# CustomLog logs/dummy-host.example.com-access_log common
#</VirtualHost>

以下の行を全部追加

# VirtualHost for www.hogehoge.com  
<VirtualHost 192.168.1.222>     
<<www.hogehoge.comの設定
ServerAdmin admin@hogehoge.com
DocumentRoot /home/hogehoge/html
ServerName www.hogehoge.com
ErrorLog logs/www.hogehoge.com-error_log
CustomLog logs/www.hogehoge.com-access_log combined
</VirtualHost>

<VirtualHost 192.168.1.222>     <<www.local.hogehoge.comの設定
ServerAdmin admin@hogehoge.com
DocumentRoot /home/hogehoge/html
ServerName www.local.hogehoge.com
ErrorLog logs/www.local.hogehoge.com-error_log
CustomLog logs/www.local.hogehoge.com-access_log combined
</VirtualHost>

# Sub-domain for linux.kaji3.com
<VirtualHost 192.168.1.222>     
<<linux.kaji3.comの設定
ServerAdmin admin@linux.kaji3.com
DocumentRoot /home/linux/html
ServerName linux.kaji3.com
ErrorLog logs/linux.kaji3.com-error_log
CustomLog logs/linux.kaji3.com-access_log combined
</VirtualHost>

<VirtualHost 192.168.1.222>     <<linux.local.kaji3.comの設定
ServerAdmin admin@linux.kaji3.com
DocumentRoot /home/linux/html
ServerName linux.local.kaji3.com
ErrorLog logs/linux.local.kaji3.com-error_log
CustomLog logs/linux.local.kaji3.com-access_log combined
</VirtualHost>

#local access as a virtual host
<VirtualHost 192.168.1.222>     
<<www.local.kaji3.comの設定
ServerAdmin admin@kaji3.com
DocumentRoot /home/www-owner/html
ServerName www.local.kaji3.com
ErrorLog logs/www.local.kaji3.com-error_log
CustomLog logs/www.local.kaji3.com-access_log combined
</VirtualHost>


Copyright (C) 2003-2004 Kaji3.com. All Rights Reserved.