# httpd-vhosts.conf の見本  2.2.0編

# 以下の"赤字"の部分を書き換えて保存する
#   (注! 以下のhttpd.confの見本は、「とにかく何でも動く」設定で、セキュリティに関しては考慮
#    していない実際はcgiを許可するディレクトリなどは慎重にセキュリティポリシーを考える)

#
# Virtual Hosts
#
# If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
#
# Please see the documentation at 
# <URL:http://httpd.apache.org/docs/2.2/vhosts/>
# for further details before you try to setup virtual hosts.
#
# You may use the command line option '-S' to verify your virtual host
# configuration.

#
# Use name-based virtual hosting.
#
NameVirtualHost *:80

#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ServerName or ServerAlias in any <VirtualHost> block.
#
# <VirtualHost *:80>
#     ServerAdmin webmaster@dummy-host.example.com
#     DocumentRoot /www/docs/dummy-host.example.com
#     ServerName dummy-host.example.com
#     ServerAlias www.dummy-host.example.com
#     ErrorLog logs/dummy-host.example.com-error_log
#     CustomLog logs/dummy-host.example.com-access_log common
# </VirtualHost>
# 
# <VirtualHost *:80>
#     ServerAdmin webmaster@dummy-host2.example.com
#     DocumentRoot /www/docs/dummy-host2.example.com
#     ServerName dummy-host2.example.com
#     ErrorLog logs/dummy-host2.example.com-error_log
#     CustomLog logs/dummy-host2.example.com-access_log common
# </VirtualHost>



# domain1.com wwwなし
<VirtualHost *:80>
    ServerName domain1.com
    ServerAdmin you@domain1.com
    DocumentRoot /export/home/webadmin/htdocs
    ErrorLog /var/log/httpd/error_log
    SetEnvIf Request_URI "\.(gif)|(jpg)|(png)$" object-is-image
    CustomLog /var/log/httpd/access_log "%h %l %u %t \"%r\" %s %b \"%{User-Agent}i\" %{Referer}i\"" env=!object-is-image
    RewriteEngine on
    RewriteOptions inherit
    Options +FollowSymLinks
    RewriteRule http://192.168.1.150/$ http://www.domain1.com/ [PT]
    AddLanguage ja .ja
    AddCharset EUC-JP .euc
    AddCharset ISO-2022-JP .jis
    AddCharset SHIFT_JIS .sjis

    <Directory />
        Options FollowSymLinks MultiViews ExecCGI Includes
        AllowOverride All
    </Directory>

    <Directory "/export/home/webadmin/htdocs/">
        Options FollowSymLinks MultiViews ExecCGI Includes
        AllowOverride All
        Order allow,deny
        Allow from all
        SetEnv gzip-only-text/html 1
        SetOutputFilter DEFLATE
    </Directory>

</VirtualHost>


# domain1.com wwwあり
<VirtualHost *:80>
    ServerName www.domain1.com
    ServerAdmin you@domain1.com
    DocumentRoot /export/home/webadmin/htdocs
    ErrorLog /var/log/httpd/error_log
    SetEnvIf Request_URI "\.(gif)|(jpg)|(png)$" object-is-image
    CustomLog /var/log/httpd/access_log "%h %l %u %t \"%r\" %s %b \"%{User-Agent}i\" %{Referer}i\"" env=!object-is-image
    RewriteEngine on
    RewriteOptions inherit
    Options +FollowSymLinks
    RewriteRule http://192.168.1.150/$ http://www.domain1.com/ [PT]
    AddLanguage ja .ja
    AddCharset EUC-JP .euc
    AddCharset ISO-2022-JP .jis
    AddCharset SHIFT_JIS .sjis

    <Directory />
        Options FollowSymLinks MultiViews ExecCGI Includes
        AllowOverride All
    </Directory>

    <Directory "/export/home/webadmin/htdocs/">
        Options FollowSymLinks MultiViews ExecCGI Includes
        AllowOverride All
        Order allow,deny
        Allow from all
        SetEnv gzip-only-text/html 1
        SetOutputFilter DEFLATE
    </Directory>

</VirtualHost>


# domain2.tv wwwなし
<VirtualHost *:80>
    ServerName domain2.tv
    ServerAdmin you@domain1.com
    DocumentRoot /export/home/domain2.tv/htdocs
    ErrorLog /export/home/domain2.tv/log/domain2_error_log
    SetEnvIf Request_URI "\.(gif)|(jpg)|(png)$" object-is-image
    CustomLog /export/home/domain2.tv/log/domain2_access_log "%h %l %u %t \"%r\" %s %b \"%{User-Agent}i\" %{Referer}i\"" env=!object-is-image
    SetOutputFilter DEFLATE
        <Directory "/export/home/domain2.tv/htdocs">
                Options FollowSymLinks MultiViews ExecCGI Includes
                AddHandler cgi-script .cgi
                AddHandler server-parsed .html
                AddType text/html .shtml
                AddType application/x-httpd-cgi .cgi
                AddType application/x-httpd-cgi .pl
                AddType application/x-httpd-php .php
                AddType application/x-httpd-php .php3
                AllowOverride AuthConfig Limit
                Order allow,deny
                deny from 192.168.*
                Allow from all
        </Directory>
</VirtualHost>


# domain2.tv wwwあり
<VirtualHost *:80>
    ServerName www.domain2.tv
    ServerAdmin you@domain1.com
    DocumentRoot /export/home/domain2.tv/htdocs
    ErrorLog /export/home/domain2.tv/log/domain2_error_log
    SetEnvIf Request_URI "\.(gif)|(jpg)|(png)$" object-is-image
    CustomLog /export/home/domain2.tv/log/domain2_access_log "%h %l %u %t \"%r\" %s %b \"%{User-Agent}i\" %{Referer}i\"" env=!object-is-image
    SetOutputFilter DEFLATE
        <Directory "/export/home/domain2.tv/htdocs">
                Options FollowSymLinks MultiViews ExecCGI Includes
                AddHandler cgi-script .cgi
                AddHandler server-parsed .html
                AddType text/html .shtml
                AddType application/x-httpd-cgi .cgi
                AddType application/x-httpd-cgi .pl
                AddType application/x-httpd-php .php
                AddType application/x-httpd-php .php3
                AllowOverride AuthConfig Limit
                Order allow,deny
                deny from 192.168.*
                Allow from all
        </Directory>
</VirtualHost>


# domain3.net wwwなし
<VirtualHost *:80>
    ServerName domain3.net
    ServerAdmin you@domain1.net
    DocumentRoot /export/home/domain3.net/htdocs
    ErrorLog /export/home/domain3.net/log/domain3_error_log
    SetEnvIf Request_URI "\.(gif)|(jpg)|(png)$" object-is-image
    CustomLog /export/home/domain3.net/log/domain3_access_log "%h %l %u %t \"%r\" %s %b \"%{User-Agent}i\" %{Referer}i\"" env=!object-is-image
    SetOutputFilter DEFLATE
        <Directory "/export/home/domain3.net/htdocs">
                Options FollowSymLinks MultiViews ExecCGI Includes
                AddHandler cgi-script .cgi
                AddHandler server-parsed .html
                AddType text/html .shtml
                AddType application/x-httpd-cgi .cgi
                AddType application/x-httpd-cgi .pl
                AddType application/x-httpd-php .php
                AddType application/x-httpd-php .php3
                AllowOverride AuthConfig Limit
                Order allow,deny
                deny from 192.168.*
                Allow from all
        </Directory>
</VirtualHost>



# domain3.net wwwあり
<VirtualHost *:80>
    ServerName www.domain3.net
    ServerAdmin you@domain1.net
    DocumentRoot /export/home/domain3.net/htdocs
    ErrorLog /export/home/domain3.net/log/domain3_error_log
    SetEnvIf Request_URI "\.(gif)|(jpg)|(png)$" object-is-image
    CustomLog /export/home/domain3.net/log/domain3_access_log "%h %l %u %t \"%r\" %s %b \"%{User-Agent}i\" %{Referer}i\"" env=!object-is-image
    SetOutputFilter DEFLATE
        <Directory "/export/home/domain3.net/htdocs">
                Options FollowSymLinks MultiViews ExecCGI Includes
                AddHandler cgi-script .cgi
                AddHandler server-parsed .html
                AddType text/html .shtml
                AddType application/x-httpd-cgi .cgi
                AddType application/x-httpd-cgi .pl
                AddType application/x-httpd-php .php
                AddType application/x-httpd-php .php3
                AllowOverride AuthConfig Limit
                Order allow,deny
                deny from 192.168.*
                Allow from all
        </Directory>
</VirtualHost>




# domain4.com wwwなし
<VirtualHost *:80>
    ServerName domain4.com
    ServerAdmin you@domain1.com
    DocumentRoot /export/home/domain4.com/htdocs
    ErrorLog /export/home/domain4.com/log/domain4_error_log
    SetEnvIf Request_URI "\.(gif)|(jpg)|(png)$" object-is-image
    CustomLog /export/home/domain4.com/log/domain4_access_log "%h %l %u %t \"%r\" %s %b \"%{User-Agent}i\" %{Referer}i\"" env=!object-is-image
    SetOutputFilter DEFLATE
        <Directory "/export/home/domain4.com/htdocs">
                Options FollowSymLinks MultiViews ExecCGI Includes
                AddHandler cgi-script .cgi
                AddHandler server-parsed .html
                AddType text/html .shtml
                AddType application/x-httpd-cgi .cgi
                AddType application/x-httpd-cgi .pl
                AddType application/x-httpd-php .php
                AddType application/x-httpd-php .php3
                AllowOverride AuthConfig Limit
                Order allow,deny
                deny from 192.168.*
                Allow from all
        </Directory>
</VirtualHost>



# domain4.com wwwあり
<VirtualHost *:80>
    ServerName www.domain4.com
    ServerAdmin you@domain1.com
    DocumentRoot /export/home/domain4.com/htdocs
    ErrorLog /export/home/domain4.com/log/domain4_error_log
    SetEnvIf Request_URI "\.(gif)|(jpg)|(png)$" object-is-image
    CustomLog /export/home/domain4.com/log/domain4_access_log "%h %l %u %t \"%r\" %s %b \"%{User-Agent}i\" %{Referer}i\"" env=!object-is-image
    SetOutputFilter DEFLATE
        <Directory "/export/home/domain4.com/htdocs">
                Options FollowSymLinks MultiViews ExecCGI Includes
                AddHandler cgi-script .cgi
                AddHandler server-parsed .html
                AddType text/html .shtml
                AddType application/x-httpd-cgi .cgi
                AddType application/x-httpd-cgi .pl
                AddType application/x-httpd-php .php
                AddType application/x-httpd-php .php3
                AllowOverride AuthConfig Limit
                Order allow,deny
                deny from 192.168.*
                Allow from all
        </Directory>
</VirtualHost>