apache中不同ip地址上的不同域

apache中不同ip地址上的不同域,apache,ubuntu,hosting,virtualhost,Apache,Ubuntu,Hosting,Virtualhost,我正在尝试设置apache,以便从不同的ip地址为不同的域提供服务 以下是我在可用站点的domain.conf中所做的操作: <VirtualHost 199.111.222.333> # Admin email, Server Name (domain name) and any aliases ServerAdmin **********@gmail.com ServerName domain1.com ServerAlias www.do

我正在尝试设置apache,以便从不同的ip地址为不同的域提供服务

以下是我在可用站点的domain.conf中所做的操作:

<VirtualHost 199.111.222.333>
  # 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

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

对于第二个,我创建了另一个domain2.conf,并放置了与上面相同的内容,只是更改了IP地址。但是它在domain1.com上运行良好,但是domain2.com根本不工作,我想要的第二个域的ip地址也没有显示apache默认页面

在站点可用目录中拥有所有domain1.conf、domain2.conf等是不够的;你是否通过运行sudo a2ensite domain2、sudo a2ensite domain3等命令启用了这些站点?我解决了这个问题。我必须在/network/interface中添加ip地址条目