【问题标题】:How do you create a virtualhost using a network share?如何使用网络共享创建虚拟主机?
【发布时间】:2017-09-21 18:47:40
【问题描述】:

因此,我在 Windows 上安装了 WAMP 以运行 Apache 和 PHP,并且我需要创建虚拟主机来访问网络共享 \\10.0.0.177\FMS Studios\Websites。当我转到域时,我收到 403 错误。这是我的 httpd-vhosts.conf 文件中的内容:

<VirtualHost *:80>
    ServerName tree.fmsds.xyz
    DocumentRoot "\\10.0.0.177\FMS Studios\Websites"
    <Directory  "\\10.0.0.177\FMS Studios\Websites">
        AllowOverride All
        Require all granted
        Order deny,allow
    </Directory>
</VirtualHost>

它甚至没有在 WAMP 的服务器管理器中注册为虚拟主机..

WAMP does not see my virtualhost.

403 Error

【问题讨论】:

  • 删除 Order deny,allow 那是 Apache 2.2 语法,不能很好地与 Require all granted 这是 Apache 2.4 语法混合
  • 还是 403 错误。

标签: apache wamp virtualhost web-hosting network-share


【解决方案1】:

首先,使用正斜杠更容易,或者如果使用反斜杠,则必须转义所有斜杠

其次,您不应混合使用 Apache 2.2 和 2.4 语法,因此如果您使用的是 Apache 2.4.x,请删除旧语法

<VirtualHost *:80>
    ServerName tree.fmsds.xyz
    DocumentRoot "//10.0.0.177/FMS Studios/Websites"
    <Directory  "//10.0.0.177/FMS Studios/Websites">
        AllowOverride All
        Require all granted
        # remove this as its Apache 2.2 syntax
        #Order deny,allow
    </Directory>
</VirtualHost>

或者使用反斜杠看起来像这样

<VirtualHost *:80>
    ServerName tree.fmsds.xyz
    DocumentRoot "\\\\10.0.0.177\\FMS Studios\\Websites"
    <Directory  "\\\\10.0.0.177\\FMS Studios\\Websites">
        AllowOverride All
        Require all granted
        # remove this as its Apache 2.2 syntax
        #Order deny,allow
    </Directory>
</VirtualHost>

现在,作为需要访问网络共享的 Apache,您需要确保启动 Apache 的帐户有权访问该网络共享,并且该共享在机器启动时可用并且不需要任何人为干预。

【讨论】:

  • 您好,谢谢您的回答。但是,关于网络共享权限的最后一部分,您知道如何在 Wamp Server 中进行设置吗?
猜你喜欢
  • 1970-01-01
  • 2014-09-16
  • 1970-01-01
  • 1970-01-01
  • 2020-11-11
  • 1970-01-01
  • 2023-03-27
  • 2023-03-18
  • 2015-02-01
相关资源
最近更新 更多