The apache virtual host sets up a method for pan domain resolution
- 2020-05-06 12:09:25
- OfStack
1, support multiple domain name
For example, having mail.jbxue.org, smtp.jbxue.org, pop3.jbxue.org all point to the same virtual host can be written as:
ServerName mail.jbxue.org
ServerAlias smtp.jbxue.org pop3.jbxue.org
ServerName is used to specify the preferred domain name. Other domains are specified by ServerAlias and separated by Spaces.
2, support for generic domain name resolution
ServerAlias supports the extender. For example, we want all secondary subdomains under xx.a.com to be resolved by the same virtual host,
<VirtualHost *:80>
ServerName xx.a.com
ServerAlias *.xx.a.com
DocumentRoot /var/www/htdocs/
</VirtualHost>