Apache虚拟主机仍然redirect到/ var / www

我试图把4个域名连接到一台服务器上,尽pipe我从来没有和Apache的虚拟主机合作过,但我想我会试试看。

我做的是以下几点:

我创build了4个.conf文件,每个域名(example.com.conf,example.eu.conf)。 这些都是与类似的configuration加载:

 <VirtualHost *:80> ServerAdmin [email protected] ServerName www.example.com ServerAlias example.com # Indexes + Directory Root. DirectoryIndex index.html DocumentRoot /home/www/www.example.com/htdocs/ # CGI Directory ScriptAlias /cgi-bin/ /home/www/www.example.com/cgi-bin/ <Location /cgi-bin> Options +ExecCGI </Location> # Logfiles ErrorLog /home/www/www.example.com/logs/error.log CustomLog /home/www/www.example.com/logs/access.log combined 

之后,我用a2ensite命令来启用所有的网站,我重新启动apache。

域名都有一个指向我的服务器IPv4的Alogging。

但是,在完成所有这些configuration之后,无论何时访问其中一个域,这些依然会显示默认的Apache启动页面(/ var / www /),而不是它们各自的索引。 我已经确定域名都在我的hosts文件中提到。

我该如何解决这个问题?

谢谢。