用ServerAlias
以前很笨,要使多个域名指向同一站点总是这样写:
<VirtualHost *>
<Directory "D:/vhosts/www.landui.com">
Options -Indexes FollowSymLinks
</Directory>
ServerAdmin admin@www.landui.com
DocumentRoot "D:/vhosts/www.landui.com"
ServerName www.landui.com
ErrorLog logs/www.landui.com_log
php_admin_value open_basedir "D:vhostswww.landui.com;C:WindowsTemp;"
<Directory "D:/vhosts/www.landui.com">
Options -Indexes FollowSymLinks
</Directory>
ServerAdmin admin@www.landui.com
DocumentRoot "D:/vhosts/www.landui.com"
ServerName www.landui.com
ErrorLog logs/www.landui.com_log
php_admin_value open_basedir "D:vhostswww.landui.com;C:WindowsTemp;"
<Directory "D:/vhosts/www.landui.com">
Options -Indexes FollowSymLinks
</Directory>
ServerAdmin admin@www.landui.com
DocumentRoot "D:/vhosts/www.landui.com"
ServerName www.landui.com
ErrorLog logs/www.landui.com_log
php_admin_value open_basedir "D:vhostswww.landui.com;C:WindowsTemp;"
</VirtualHost>
这样一来就等于绑了多少域名就开了多少虚拟主机…………
后来,发现有个叫”ServerAlias“的东西可以用
其实可以这样:
<VirtualHost *>
<Directory "D:/vhosts/www.landui.com">
Options -Indexes FollowSymLinks
</Directory>
ServerAdmin admin@www.landui.com #管理服务器的邮箱 一般都不需要填写
DocumentRoot "D:/vhosts/www.landui.com" #网站的目录
ServerName www.landui.com #需要绑定的域名
ServerAlias www.landui.com www.landui.com www.landui.com #绑定多个域名
ErrorLog logs/www.landui.com_log #错误日志目录
php_admin_value open_basedir "D:vhostswww.landui.com;C:WindowsTemp;" #上传文件的临时目录.
</VirtualHost>