单个回答详细

Apache中配置多个域名并不是写多个ServerAlias,而是把域名写到一个ServerAlias中,用空格隔开:


<VirtualHost *:80>
    DocumentRoot "/www"
    ServerName a.com
    ServerAlias www.a.com b.com www.b.com *.a.com *.b.com;
</VirtualHost>

*.a.com这样写是泛解析域名。


Nginx中一个网站配置多个域名也是相似的:


server {
    listen       80;
    server_name  example.org  www.example.org  *.example.org;
    ...
}



参考:

Name-based Virtual Host Support - Apache HTTP Server Version 2.4  

https://httpd.apache.org/docs/2.4/vhosts/name-based.html


Server names  

https://nginx.org/en/docs/http/server_names.html