帮助中心 >  技术知识库 >  网站相关 >  建站知识 >  APACHE如何在一个站点绑定多个域名?

APACHE如何在一个站点绑定多个域名?

2015-11-20 15:46:50 7980

    用ServerAlias

    以前很笨,要使多个域名指向同一站点总是这样写:

<VirtualHost *>

    <Directory "D:/vhosts/www.landui.com">
        Options -Indexes FollowSymLinks
    </Directory>
    ServerAdmin admin@www.landui.com
    DocumentRoot "D:/vhosts/www.landui.com"
    ServerName www.landui.com
    ErrorLog logs/www.landui.com_log
    php_admin_value open_basedir "D:vhostswww.landui.com;C:WindowsTemp;"

    <Directory "D:/vhosts/www.landui.com">
        Options -Indexes FollowSymLinks
    </Directory>
    ServerAdmin admin@www.landui.com
    DocumentRoot "D:/vhosts/www.landui.com"
    ServerName www.landui.com
    ErrorLog logs/www.landui.com_log
    php_admin_value open_basedir "D:vhostswww.landui.com;C:WindowsTemp;"

    <Directory "D:/vhosts/www.landui.com">
        Options -Indexes FollowSymLinks
    </Directory>
    ServerAdmin admin@www.landui.com
    DocumentRoot "D:/vhosts/www.landui.com"
    ServerName www.landui.com
    ErrorLog logs/www.landui.com_log
    php_admin_value open_basedir "D:vhostswww.landui.com;C:WindowsTemp;"
</VirtualHost>
这样一来就等于绑了多少域名就开了多少虚拟主机…………
后来,发现有个叫”ServerAlias“的东西可以用
其实可以这样:
<VirtualHost *>
    <Directory "D:/vhosts/www.landui.com">
        Options -Indexes FollowSymLinks
    </Directory>
    ServerAdmin admin@www.landui.com                            #管理服务器的邮箱 一般都不需要填写
    DocumentRoot "D:/vhosts/www.landui.com"                     #网站的目录
    ServerName www.landui.com                                   #需要绑定的域名
    ServerAlias www.landui.com www.landui.com www.landui.com        #绑定多个域名
    ErrorLog logs/www.landui.com_log                      #错误日志目录
  php_admin_value open_basedir "D:vhostswww.landui.com;C:WindowsTemp;" #上传文件的临时目录.
</VirtualHost>

提交成功!非常感谢您的反馈,我们会继续努力做到更好!

这条文档是否有帮助解决问题?

非常抱歉未能帮助到您。为了给您提供更好的服务,我们很需要您进一步的反馈信息:

在文档使用中是否遇到以下问题: