其中*对于每个客户端都不同,例如apple.example.com,pearl.example.com。 这些都应该路由到相同的IP和相同的目录。 如何修改hosts文件和httpd配置?
更详细的例子:
<VirtualHost 111.22.33.44>
ServerName customer-1.example.com
DocumentRoot "/www/hosts/example.com/docs"
ScriptAlias "/cgi-bin/" "/www/hosts/example.com/cgi-bin"
</VirtualHost>
<VirtualHost 111.22.33.44>
ServerName customer-2.example.com
DocumentRoot "/www/hosts/example.com/docs"
ScriptAlias "/cgi-bin/" "/www/hosts/example.com/cgi-bin"
</VirtualHost>
<VirtualHost 111.22.33.44>
ServerName customer-N.example.com
DocumentRoot "/www/hosts/example.com/docs"
ScriptAlias "/cgi-bin/" "/www/hosts/example.com/cgi-bin"
</VirtualHost>
谢谢!
答案 0 :(得分:0)
您可以在 ServerAlias 中使用星标,如下所示:
<VirtualHost 111.22.33.44>
ServerName customer-1.example.com
ServerAlias *.example.com
DocumentRoot "/www/hosts/example.com/docs"
ScriptAlias "/cgi-bin/" "/www/hosts/example.com/cgi-bin"
</VirtualHost>