2014-10-22 116 views
0

我想在兩個不同的IP地址上建立兩個不同的域:bbb.zzz.xxx.yyy & bbb.xxx.yyy.zzz。問題是,domain1工作正常。當我在瀏覽器中輸入IP地址時,第二個站點(domain2)正在工作,但是當我輸入wwww.domain2.com時,它會顯示domain1的內容。我應該如何解決這個問題?是否有任何模塊丟失?我在站點可用目錄中爲不同的域使用不同的文件。Apache兩個域在兩個不同的IP地址

<VirtualHost bbb.zzz.xxx.yyy> 
    # Admin email, Server Name (domain name) and any aliases 
    ServerAdmin **********@gmail.com 
    ServerName domain1.com 
    ServerAlias www.domain1.com 

    # Index file and Document Root (where the public files are located) 
    DirectoryIndex index.php 
    DocumentRoot /home/ApacheWebsites/domain1/httpdocs 

    # Custom log file locations 
    LogLevel warn 
    ErrorLog /home/ApacheWebsites/logs/error.log 


CustomLog /home/ApacheWebsites/logs/access.log combined 


    <Directory /home/ApacheWebsites/domain1/httpdocs/> 
      Options Indexes FollowSymLinks MultiViews 
      AllowOverride All 
      Require all granted 
      allow from all 
    </Directory> 

<VirtualHost bbb.xxx.yyy.zzz> 
    # Admin email, Server Name (domain name) and any aliases 
     ServerAdmin ************@gmail.com 
     ServerName domain2.com 
     ServerAlias www.domain2.com 

     # Index file and Document Root (where the public files are located) 
     DirectoryIndex index.php 
     DocumentRoot /home/ApacheWebsites/domain2 

     # Custom log file locations 
     LogLevel warn 
     ErrorLog /home/ApacheWebsites/logs/error.log 
    CustomLog /home/ApacheWebsites/logs/access.log combined 
     <Directory /home/ApacheWebsites/domain2/> 
       Options Indexes FollowSymLinks MultiViews 
       AllowOverride All 
       Require all granted 
       allow from all 
     </Directory> 
</VirtualHost> 

回答

0

你的第一個片段說

ServerName domain1.com 
ServerAlias www.domain2.com 

更改服務器別名www.domain1.com,它應該工作。

+0

哦,那是我的不好,一個錯字。糾正。 – akshayb 2014-10-22 11:35:48

+0

www.domain2.com解析爲正確的IP地址? – 2014-10-22 11:39:24

+0

哦,對不起,它解決了分配給域1的IP地址 – akshayb 2014-10-22 11:50:38

相關問題