【问题标题】:Try to add a VirtualHost尝试添加一个虚拟主机
【发布时间】:2012-11-27 11:29:56
【问题描述】:

我有一个带有网站的网络服务器,我想添加另一个地址以供预生产使用。

这里是存在的:

httpd.conf:

ServerAdmin support@toto.com
ServerName www.toto.com:80
DocumentRoot "/home/tutu/var/www/html"

模块/vhost.conf:

<VirtualHost *:80>
    ServerAdmin support@toto.com
    ServerName www.toto.com:80
    DirectoryIndex index.php

    ErrorLog /home/tutu/var/log/httpd/error-mod_log
    LogLevel warn
    CustomLog /home/tutu/var/log/httpd/access-mod_log common-cookie

   <Location /server-status>
    SetHandler server-status
    Order deny,allow
    Deny from all
    Allow from 127.0.0.1
  </Location>
</VirtualHost>

我尝试添加另一个虚拟主机,但新地址不起作用:

<VirtualHost *:80>
    ServerAdmin support@toto.com
    ServerName www2.toto.com:80
    DirectoryIndex index.php

    ErrorLog /home/tutu/var/log/httpd/error-www2_log
    LogLevel warn
    CustomLog /home/tutu/var/log/httpd/access-www2_log common-cookie
    DocumentRoot "/home/tutu/var/www2/html"
</VirtualHost>

地址 www2.toto.com 无效。 你有什么想法吗?

谢谢

【问题讨论】:

    标签: apache vhosts


    【解决方案1】:

    您是否已将 www2.toto.com 添加到 DNS 中? 它尚未添加到公共 DNS。 (但 www.toto.com 是)

    “不工作”不是很具体。您是否获得了该站点的默认 Apache 网页,或者您没有访问服务器?如果是后者,DNS 查找可能是您真正的问题,而不是 Apache 配置。

    Apache-config 看起来不错,但您不需要指定 :80 作为别名端口。

    【讨论】:

    • 对不起,我没有连接到服务器。
    猜你喜欢
    • 1970-01-01
    • 2016-05-12
    • 2010-10-07
    • 1970-01-01
    • 2021-12-01
    • 2012-07-08
    • 2017-02-27
    • 2019-11-14
    • 2014-04-22
    相关资源
    最近更新 更多