设置VirtualHost – 全部指向相同的主机

我试图将我的域名yfcclub.ga设置为/var/www/yfc文件夹,而将本地主机和所有其他域名保留在/var/www/html中。 我的vhosts.cof文件是:

 <VirtualHost _default_:80> DocumentRoot /var/www/html <Directory /var/www/html> Options Indexes FollowSymLinks MultiViews AllowOverride All Order allow,deny allow from all </Directory> ErrorLog /var/www/html/error.log CustomLog /var/www/html/access.log combined </VirtualHost> <VirtualHost yfcclub.ml:80> ServerName yfcclub.ml ServerAdmin [email protected] DocumentRoot /var/www/yfc <Directory /var/www/yfc> Options Indexes FollowSymLinks MultiViews AllowOverride All Order allow,deny allow from all </Directory> ErrorLog /var/www/yfc/.errors/error.log CustomLog /var/www/yfc/.errors/access.log combined </VirtualHost> 

但是,所有域和localhost指向var/www/yfc文件夹。 我错过了什么吗?

 Change "VirtualHost" record. <VirtualHost *:80> ... </VirtualHost> <VirtualHost *:80> DocumentRoot /var/www/html <Directory /var/www/html> Options Indexes FollowSymLinks MultiViews AllowOverride All Order allow,deny allow from all </Directory> ErrorLog /var/www/html/error.log CustomLog /var/www/html/access.log combined </VirtualHost> <VirtualHost *:80> ServerName yfcclub.ml ServerAdmin [email protected] DocumentRoot /var/www/yfc <Directory /var/www/yfc> Options Indexes FollowSymLinks MultiViews AllowOverride All Order allow,deny allow from all </Directory> ErrorLog /var/www/yfc/.errors/error.log CustomLog /var/www/yfc/.errors/access.log combined </VirtualHost>