【问题标题】:Why VirtualHost not working?为什么虚拟主机不工作?
【发布时间】:2015-03-05 02:47:06
【问题描述】:

这可能是个愚蠢的查询。我的 VirtualHost 无法正常工作,不知道为什么?

我在 /etc/apache2/site-enabled 中有 myvhost.conf。它看起来像:

<VirtualHost *:80>

    ServerName dev.mydomain.com

    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/html/test

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>

我在 Ubuntu:14.10,Apache:2.4.10。我还有其他 vhost 文件 000-default.conf default-ssl.conf。默认(http 和 https)正在运行。

编辑:当我浏览 dev.mydomain.com 时,我得到 Apache 默认页面 iie。 “Apache2 Ubuntu 默认页面”

提前致谢

【问题讨论】:

  • 日志文件有错误吗?或者语法?如果您使用 -t 选项启动 apache 会发生什么?
  • 没有错误 - 我在执行 dev.mydomain.com 时得到默认页面“Apache2 Ubuntu 默认页面”
  • dev.mydomain.com 是系统主机名吗?

标签: apache


【解决方案1】:

试试这个并删除你的默认虚拟主机:

<VirtualHost *:80>                                                                                                                                                                                       
  ServerName  dev.mydomain.com

  DocumentRoot /var/www/html/test
  <Directory /var/www/html/test>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Order allow,deny
    allow from all
  </Directory>

 ErrorLog ${APACHE_LOG_DIR}/error.log
 LogLevel warn

 CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>

【讨论】:

    猜你喜欢
    • 2015-05-19
    • 2014-07-04
    • 2013-04-10
    • 2017-07-05
    • 2016-11-07
    • 2018-05-09
    • 2011-03-08
    相关资源
    最近更新 更多