我正在尝试将我的域名 yfcclub.ga 设置为文件夹,/var/www/yfc
同时将 localhost 和所有其他域名保留/var/www/html
在 ubuntu 中。我的 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>
但是,所有域和本地主机都指向
var/www/yfc
文件夹。我是否遗漏了什么?
答案1
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>