2010-12-12 5 views
3

ellooを指して私は2つのバーチャルホストのサブドメインは、別のディレクトリを指している私は、ブラウザの両方のサブドメインをロードするときしかし、私はそれらの両方が同じディレクトリを指し得ます。私のvhost.confはここにあります。Apacheのvirutalhostサブドメインが</p> <p>、同じディレクトリに

<VirtualHost *:80> 
     ServerAdmin [email protected] 
     ServerName subdomain1.domain.com 
     ServerAlias *.domain.com 

     #Indexes + Directory Root. 
     DirectoryIndex index.php   
     DocumentRoot /subomain1/path/to/directory/trunk 

     #Logfiles 
     ErrorLog /subomain1/path/to/directory/trunk/error.log 
     CustomLog /subomain1/path/to/directory/trunk//access.log combined 
</VirtualHost> 

<VirtualHost *:443> 
     ServerAdmin [email protected] 
     ServerName subdomain1.domain.com 
     ServerAlias *.subdomain.com 

     DirectoryIndex index.php   
     DocumentRoot /subomain1/path/to/directory/trunk 

     SSLEngine On 
     SSLCertificateFile /ssl/certs/subdomain1.crt 
     SSLCertificateKeyFile /ssl/private/subdomain1.key 
     SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown 
</VirtualHost> 

<VirtualHost *:80> 
     ServerAdmin [email protected] 
     ServerName subdomain2.domain.com 
     ServerAlias *.domain.com 

     #Indexes + Directory Root. 
     DirectoryIndex index.php   
     DocumentRoot /subomain2/path/to/directory/trunk 

     #Logfiles 
     ErrorLog /subomain2/path/to/directory/trunk/error.log 
     CustomLog /subomain2/path/to/directory/trunk//access.log combined 
</VirtualHost> 

<VirtualHost *:443> 
     ServerAdmin [email protected] 
     ServerName subdomain2.domain.com 
     ServerAlias *.subdomain.com 

     DirectoryIndex index.php   
     DocumentRoot /subomain2/path/to/directory/trunk 

     SSLEngine On 
     SSLCertificateFile /ssl/certs/subdomain2.crt 
     SSLCertificateKeyFile /ssl/private/subdomain2.key 
     SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown 
</VirtualHost> 

私は答えはどれも役に立たないと思われます。

私はにServerAliasディレクティブがあることを示しているので、私はそのyoureの両方の仮想ホスト上で* .domain.com

を にServerAliasを使用しているためだと思うのUbuntuサーバに事前

+0

がにServerAliasを見たことがない* .mydomain.tld ...あなたはこのラインなしてみましたか? – Aif

答えて

0

多くの感謝を使用していますリストされた名前は、同じWebサイトを見るために他の名前を使用できます。

ServerAlias * .subdomain.com

subdomain.comドメイン内のすべてのホストに対する要求は、subdomain1.domain.com仮想ホストによって処理されます。

これはあなたがこれを解決した場合http://httpd.apache.org/docs/2.0/vhosts/name-based.html

1

は知らないが、私は同じ問題を持っていたし、それは私がこのようにhttpd.confファイルを変更するのを忘れ判明助けるかもしれない:

"httpd.conf"を開き、 "Include /private/etc/apache2/extra/httpd-vhosts.conf"という行番号461(約)のコメントを外し、保存します。貴重ですこのチュートリアルから取ら

http://kevchapman.co.uk/development/setting-up-apache-on-snow-leopard/

関連する問題