
Home > Debian > Webサーバ > バーチャルホストの設定
| バーチャルホストの設定 |
バーチャルホストを利用すれば、1つの回線+サーバで複数のドメインを利用して
それぞれのドメインで違うページにアクセスさせることが可能。
以下では例として、chibi.name と uniunix.net とで、違うページにアクセスさせる為、
バーチャルホストの設定を行なう。なお、uniunix.netのドキュメントルートは
/var/www/uniunixとするので、予めドキュメントルートにするディレクトリを作成しておく。
# vi /etc/apache2/sites-available/uniunix ←新規で作成
<VirtualHost *>
ServerName uniunix.net ←今回設定するuniunix.netを指定
DocumentRoot /var/www/uniunix ←ドキュメントルートの指定
setenvif Request_URI "default\.ida" no
setenvif Request_URI "root\.exe" no
setenvif Request_URI "cmd\.exe" no
setenvif Request_URI "Admin\.dll" no
setenvif Request_URI "NULL\.IDA" no
setenvif Request_URI "\.(gif)|(jpg)|(png)|(ico)|(css)$" no
setenvif Remote_Addr 192.168.1 no
CustomLog /var/log/apache2/uniunix_access.log combined env=!no ←以上、ワームログ等の排除
ErrorLog /var/log/apache2/uniunix_error.log
<Directory /var/www/uniunix>
Options IncludesNoExec ExecCGI FollowSymLinks
AllowOverride None
</Directory>
</VirtualHost>
上記では注意すべき部分を緑字とした。
またアクセスログやエラーログはメインのaccess.logやerror.logと別にした。
|
続いて、この設定ファイルを有効にし、その後でApacheを再起動する
# a2ensite Which site would you like to enable? Your choices are: debian default default.05-07-03 ssl Site name? uniunix ←作成したuniunixファイルを指定 Site uniunix installed; run /etc/init.d/apache2 reload to enable. # /etc/init.d/apache2 restart |
設定ファイルを有効にすると、/etc/apache2/sites-enabled/にuniunixファイルが出来上がる
なお、この設定ファイルを無効にしたい場合は、以下のようにし、Apacheを再起動する
# a2dissite Which site would you like to disable? Your choices are: 000-default debian ssl Site name? uniunix ←uniunixファイルを指定 Site uniunix disabled; run /etc/init.d/apache2 reload to fully disable. # /etc/init.d/apache2 restart |
最終更新 : 09/26/2005