我已经用以下方式配置了带有子域的apache2虚拟主机:
/etc/apache2/网站-可查阅/网站:
<VirtualHost *>
ServerName website.local
ServerAlias sub.website.local
DocumentRoot /home/myname/dev/website/web/
...
</VirtualHost> /etc/主机
127.0.0.1 website.local
127.0.0.1 sub.website.local而且起作用了!http://website.local和http://sub.websitel.local都指向DocumentRoot。现在,我如何重新配置它,以便任何子域http://*.website.local都指向DocumentRoot?
发布于 2010-10-07 15:47:50
您可以使用通配符来匹配apache中的任何子域名:
serveralias *.website.local问题是主机文件不支持通配符。如果使用本地dns绑定服务作为解析器,则可以注册website.local区域并创建dns通配符。
发布于 2010-10-07 15:46:37
在apache.conf中:
ServerAlias *.website.local
但是,不可能在/etc/主机中使用通配符。您需要为此设置一个DNS服务器。
https://serverfault.com/questions/188647
复制相似问题