【问题标题】:OS X Server ignores virtual hostsOS X Server 忽略虚拟主机
【发布时间】:2013-09-26 15:31:34
【问题描述】:

我有一个 OS X Server 10.8 [带有服务器应用程序]。我已启用网站服务,并将/Volumes/dev1/http 的路径添加为我的服务器网站的根目录。

我在/private/etc/apache2/httpd.conf 中编辑了文件并添加了以下行:Include /Volumes/dev1/http/.virtual-hosts

/Volumes/dev1/http/.virtual-hosts 的文件类似于:

listen 80
listen 443
servername "site"
serveradmin "mail@myemail.com"
namevirtualhost *:80
namevirtualhost *:443

directoryindex .index.php index.html index.php
options -indexes -multiviews +followsymlinks

<directory /Volumes/dev1/http>
    allowoverride all
</directory>

<virtualhost *:80 *:443>
    servername site.com
    serveralias www.site.com
    documentroot "/Volumes/dev1/http/com-site"
    rewriteengine on
</virtualhost>

服务器完全忽略这个文件,即使我输入一些随机字符并运行apachectl -t 它说语法不正确。

我什至尝试在此文件中仅包含 directoryindex .index.php,但它仍然没有效果 - 它返回 403 Forbidden,即使认为存在 .index.php

这个精确的配置在旧的 10.6 服务器上就像一个魅力。

感谢您花时间考虑我的问题!

【问题讨论】:

    标签: macos apache apache2 webserver virtualhost


    【解决方案1】:

    经过一些谷歌搜索和反复试验后,答案是:在 OS 10.8 中使用服务器应用程序时,您需要将 include 指令放在 /Library/Server/Web/Config/apache2/httpd_server_app.conf not/private/etc/apache2/httpd.conf

    【讨论】:

      猜你喜欢
      • 2018-02-08
      • 1970-01-01
      • 2012-12-26
      • 2014-11-10
      • 2010-10-21
      • 2016-07-15
      • 1970-01-01
      • 2019-11-14
      • 2021-09-29
      相关资源
      最近更新 更多