Rootop 服务器运维与web架构

apache 添加多域名支持 (绑定多个域名)

| 暂无评论

      基于域名的虚拟主机,添加多域名支持只需配置<virtualhost> 这段代码即可

方式如下:

<VirtualHost www.nq.com:80 (这里有个空格)www.rootop.org:80>
    ServerAdmin venuslinux@gmail.com
    DocumentRoot /wz/nq
    ServerName www.nq.com
    ErrorLog logs/nq.com-error_log
    CustomLog logs/nq.com-access_log common
    directoryindex index.php
</virtualhost>

       后面的www.rootop.org:80 就是所添加的域名,这样一来,即可以通过www.nq.com 来访问也可以通过www.rootop.org访问了。

第二种方法:

在<VirtualHost></VirtualHost>字段之间加一行 ServerAlias www.domain.com 即可。

所有要绑定的域名都写在serveralias 后面

参考链接:https://www.rootop.org/ApacheManual/Apache2.2_zh_CN/vhosts/name-based.html

原创文章,转载请注明。本文链接地址: https://www.rootop.org/pages/253.html

作者:Venus

服务器运维与性能优化

发表回复