apache 中 ServerAlias让多个域名绑定到同一空间
apache 中 ServerAlias让多个域名绑定到同一空间
在apache 中可以配置多个别名,中间用空格隔开:ServerAlias eedu.org.cn en.eedu.org.cn 这些域名都访问同一个站点。
<VirtualHost *:80>
ServerAdmin xxx@foxmail.com
DocumentRoot "/usr/local/web/apache/htdocs/"
ServerName www.eedu.org.cn #默认域名
ServerAlias eedu.org.cn en.eedu.org.cn #不同域名用空格隔开
<proxy balancer://cluster>
BalancerMember ajp://127.0.0.1:8010/ loadfactor=1 route=jvm8010
BalancerMember ajp://127.0.0.1:8011/ loadfactor=1 route=jvm8011
</proxy>
ProxyPass / balancer://cluster/ stickysession=JSESSIONID nofailover=On lbmethod=byrequests timeout=5 maxattempts=5
ProxyPassReverse / balancer://cluster/
ErrorLog "logs/www.eedu.org.cn-error_log"
CustomLog "logs/www.eedu.org.cn-access_log" common
</VirtualHost>
==========================================
虚拟主机接收泛域名解析可以通过SeverAlias选项设置,同时可以接收二级、三级、四级泛域名解析,具体设置如下:
<VirtualHost *:80>
ServerAdmin xxx@foxmail.com
DocumentRoot "/usr/local/web/apache/htdocs/"
ServerName www.eedu.org.cn #默认域名
ServerAlias *.eedu.org.cn #用*表示泛域名,如果要接收三级泛域名解析,可以写成这样:*.my.eedu.org.cn
<proxy balancer://cluster>
BalancerMember ajp://127.0.0.1:8010/ loadfactor=1 route=jvm8010
BalancerMember ajp://127.0.0.1:8011/ loadfactor=1 route=jvm8011
</proxy>
ProxyPass / balancer://cluster/ stickysession=JSESSIONID nofailover=On lbmethod=byrequests timeout=5 maxattempts=5
ProxyPassReverse / balancer://cluster/
ErrorLog "logs/www.eedu.org.cn-error_log"
CustomLog "logs/www.eedu.org.cn-access_log" common
</VirtualHost>