简体   繁体   English

在 Windows 服务器 2019 标准版上使用 Apache 的网络共享问题

[英]Problems with network shares using Apache on Windows server 2019 Standard

I am replacing an old web server running IIS 7 (?) with a new server running XAMPP (Apache 2.4) on a Windows Server 2019 Standard machine.我正在将运行 IIS 7 (?) 的旧服务器 web 替换为在 Windows Server 2019 Standard 机器上运行 XAMPP (Apache 2.4) 的新服务器。 I have a couple of.network shares with content I need to display, but I cannot get Apache configured correctly.我有几个需要显示内容的网络共享,但我无法正确配置 Apache。 I am calling one such.network folder "eom".我称一个这样的.network 文件夹为“eom”。

I created a new user specfically to run the Apache service, the user account has.network access, and I have the service running as that user.我专门创建了一个新用户来运行 Apache 服务,该用户帐户具有网络访问权限,并且我以该用户身份运行该服务。 That user (as well as my own user account) has full control/access to the.network folder identified below.该用户(以及我自己的用户帐户)可以完全控制/访问下面标识的 .network 文件夹。

I have tried simply identifying the.network location with a block, like this:我试过用一个块简单地识别 .network 位置,如下所示:

<Directory "//OLDSERVER/data/eom">
  AllowOverride None
  Allow from All
  Options +FollowSymLinks
</Directory>
Alias /eom/ "//OLDSERVER/data/eom"

In this case, "/data" is a shared folder.在这种情况下,“/data”是一个共享文件夹。 If I try it with the drive letter identified like "//OLDSERVER/c$/data/eom", Apache doesn't like it.如果我尝试使用标识为“//OLDSERVER/c$/data/eom”的驱动器号,Apache 不喜欢它。 It says the path is invalid.它说路径无效。

I have also tried creating a symbolic link called "eom" and pointing to the same folder with this command:我还尝试创建一个名为“eom”的符号链接,并使用此命令指向同一文件夹:

mklink /D eom \\OLDSERVER\data\eom 

When I created the symlink, I commented out the block in the config file.当我创建符号链接时,我在配置文件中注释掉了该块。 Nothing is working.什么都不起作用。 No matter how I try it, the response I get is "403 Forbidden You don't have permission to access this resource."无论我如何尝试,我得到的响应都是“403 Forbidden You don't have permission to access this resource”。

I have also tried starting the web service as myself, especially when testing the symbolic link, but I always get the same result.我也尝试以自己的身份启动 web 服务,尤其是在测试符号链接时,但我总是得到相同的结果。

Any help is appreciated.任何帮助表示赞赏。

FINALLY figured it out: The steps are (all from the web server):终于想通了:步骤是(全部来自web服务器):

  1. make sure you have access rights to the content you are trying to share确保您有权访问要共享的内容

  2. find the IP address of the remote server with the needed content找到包含所需内容的远程服务器的 IP 地址

    ping -a \OLDSERVER ping -a \OLDSERVER

  3. navigate to your web root folder, in my case "c:\xampp\htdocs".导航到您的 web 根文件夹,在我的例子中是“c:\xampp\htdocs”。

  4. use "mklink" to create a symbolic link:使用“mklink”创建符号链接:

    mklink /D eom \10.20.30.40\data\eom mklink /D eom \10.20.30.40\data\eom

  5. add block in your httpd.conf file:在您的 httpd.conf 文件中添加块:

    <Directory "/eom"> AllowOverride none Allow from All Options +FollowSymLinks <Directory "/eom"> AllowOverride none 从所有选项中允许 +FollowSymLinks

  6. restart Apache重启 Apache

Now you can test.现在你可以测试了。 There may be other ways to do it, but this is what has finally worked for me.可能还有其他方法可以做到这一点,但这是最终对我有用的方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM