2011-07-27 7 views
1

私のApacheサーバに問題があります。ApacheでのVhost設定

私はちょうど新鮮なインストールをしました(debian 6.0)。

/etc/apache2/ sites-availableにmysite.comとdev.mysite.comの2つの設定ファイルを作成しました。これらをa2ensiteコマンドで有効にして、サーバを再ロードしました(/etc/init.d/)。

2つのリクエストを自分のサーバーにリダイレクトするようにホストファイルを変更しました。 mysite.comにアクセスしようとすると問題はありませんが、dev.mysite.comにアクセスしようとするとmysite.comの内容が表示されます。ここで

は私の設定ファイルは以下のとおりです。

:apache2.conf

# Include ports listing 
Include ports.conf 

# Include the virtual host configurations: 
Include sites-enabled/* 

ports.confファイル

# If you just change the port or add more ports here, you will likely also 
# have to change the VirtualHost statement in 
# /etc/apache2/sites-enabled/000-default 
# This is also true if you have upgraded from before 2.2.9-3 (i.e. from 
# Debian etch). See /usr/share/doc/apache2.2-common/NEWS.Debian.gz and 
# README.Debian.gz 

NameVirtualHost *:80 
Listen 80 

<IfModule mod_ssl.c> 
    # If you add NameVirtualHost *:443 here, you will also have to change 
    # the VirtualHost statement in /etc/apache2/sites-available/default-ssl 
    # to <VirtualHost *:443> 
    # Server Name Indication for SSL named virtual hosts is currently not 
    # supported by MSIE on Windows XP. 
    Listen 443 
</IfModule> 

<IfModule mod_gnutls.c> 
    Listen 443 
</IfModule> 

サイト-利用可能/ mysite.comファイルの

一部

<VirtualHost *> 
     ServerAdmin [email protected] 
     ServerName www.mysite.com 
     ServerAlias mysites.com 
     ServerAlias www.mysites.com 
     ServerAlias mysite.com 
     DocumentRoot /media/Data/www/mysiteCom 
     <Directory /> 
       Options FollowSymLinks 
       AllowOverride All 
     </Directory> 
     <Directory /media/Data/www/mysiteCom> 
       Options Indexes FollowSymLinks MultiViews 
       AllowOverride All 
       Order allow,deny 
       Allow from all 
     </Directory> 
     ErrorLog /var/log/apache2/error_mysiteCom 
     LogLevel warn 
     CustomLog /var/log/apache2/access_mysiteCom combined 
     ServerSignature Off 
</VirtualHost> 

my sit es-available/dev.mysite.comファイル:

<VirtualHost *> 
     ServerAdmin [email protected] 
     ServerName dev.mysite.com 
     ServerAlias dev.mysites.com 
     DocumentRoot /media/Data/www/devMysiteCom 
     <Directory /> 
       Options FollowSymLinks 
       AllowOverride All 
     </Directory> 
     <Directory /media/Data/www/devMysiteCom> 
       Options Indexes FollowSymLinks MultiViews 
       AllowOverride All 
       Order allow,deny 
       Allow from all 
     </Directory> 
     ErrorLog /var/log/apache2/error_devMysiteCom 
     LogLevel warn 
     CustomLog /var/log/apache2/access_devMysiteCom combined 
     ServerSignature Off 
</VirtualHost> 

私が間違っていたことは何ですか?

+1

これは正しく私のバーチャルホストを設定するには、実際に私を助けました。どうもありがとうございました! – lokers

答えて

2

私のエラーが見つかりました。

事実で

、アクセスされるポートに言及することは必須であると思われるので、私はVirtualHostの中でそれを設定する必要がありました:

<VirtualHost *:80> 
関連する問題