windows Apache 网络驱动器别名

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7431658/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 18:05:15  来源:igfitidea点击:

Apache Network Drive Alias

windowsapachenetworkingalias

提问by SortingHat

I've searched through stackoverflow for a similiar problem, but none of the solutions seem to work.

我已经在 stackoverflow 中搜索了类似的问题,但似乎没有一个解决方案有效。

I'm running WAMP and have a network drive T:\which I want to use as an alias in Apache. So far I have added:

我正在运行 WAMP 并有一个网络驱动器T:\,我想在 Apache 中将其用作别名。到目前为止,我已添加:

Alias /p \\ps-file.server_location.edu\A$
< Directory /p>
Order allow,deny
Allow from all
< / Directory>

别名 /p \\ps-file.server_location.edu\A$
<目录 /p>
Order allow,deny
Allow from all
</目录>

However, whenever I try to access localhost/pI get a 403 forbidden message saying You don't have permission to access /p on this server.Any suggestions?

但是,每当我尝试访问时,localhost/p我都会收到一条 403 禁止消息,上面写着You don't have permission to access /p on this server.任何建议?

I have tried changing the logon settings in services.msc, but this stops apache from starting all together.

我曾尝试更改 services.msc 中的登录设置,但这会阻止 apache 一起启动。

EDIT: I also have to enter my login information for the network drive the first time I connect it. Can I somehow give apache my login information?

编辑:我还必须在第一次连接网络驱动器时输入我的登录信息。我可以以某种方式向 apache 提供我的登录信息吗?

回答by Caltor

You need to use forward slashes instead of backslashes or escape them all using an additional backslashas well as enclosing the paths in quotes as stated by Xophmeister. Eg:

您需要使用正斜杠而不是反斜杠,或者使用额外的反斜杠将它们全部转义,并将路径括在 Xophmeister 所述的引号中。例如:

Alias /p "//ps-file.server_location.edu/A$/"
<Directory "//ps-file.server_location.edu/A$/">
Order allow,deny
Allow from all
</Directory>

or

或者

Alias /p "\\ps-file.server_location.edu\A$\"
<Directory "\\ps-file.server_location.edu\A$\">
Order allow,deny
Allow from all
</Directory>

You are correct to use a UNC path unless you create a mapped drive in the user profile being used to run the apache service.

除非您在用于运行 apache 服务的用户配置文件中创建映射驱动器,否则使用 UNC 路径是正确的。

回答by Emre Karata?o?lu

caltor is right , little edit here , you can use <Directory "/p">cause it has alias.But I hate writing network drive in config like //p...also

caltor是正确的,小编辑在这里,你可以使用<Directory "/p">导致它有alias.But我讨厌写作的网络驱动器的配置一样//p...

There is another problem occurs here , in this method , you cannot execute exec() or batch file , cannot take the information of directory , open_dir etc cannot return a result , also apache cannot start as a service . To solve that,

这里还有一个问题,在这种方法中,不能执行exec()或批处理文件,不能取目录信息,open_dir等不能返回结果,apache不能作为服务启动。为了解决这个问题,

First of all download http://technet.microsoft.com/en-us/sysinternals/bb842062.aspxExtract zip file to C:/sys. Open cmd , and

首先下载 http://technet.microsoft.com/en-us/sysinternals/bb842062.aspx 将zip 文件解压缩到 C:/sys。打开 cmd ,然后

cd c:/sys (enter)
psexec -i -s cmd.exe

then a new command line appears . All you need

然后出现一个新的命令行。一切你需要的

net use j: \lethea\sharedfolder /persistent:yes

will ask username and password of lethea pc . Here is j: the short name of the network drive . After doing this , in httpd.conf folder you dont need to create alias or write full network map to Documentroot and directory

会询问lethea pc的用户名和密码。这是 j:网络驱动器的短名称。执行此操作后,在 httpd.conf 文件夹中,您不需要创建别名或将完整的网络映射写入 Documentroot 和目录。

Documentroot = "j:/mywww"  #referencing \lethea\sharedfolder\mywww
<Directory "j:/mywww">

...

...

回答by Xophmeister

Why not just alias to T:\, as in Alias /p T:\? Otherwise, my guess is that Apache doesn't have the necessary permissions to access the specified UNC (particularly, the A$bit is probably screwing things up as it is a special share).

为什么不只是 T:\ 的别名,如Alias /p T:\?否则,我的猜测是 Apache 没有访问指定 UNC 的必要权限(特别是,这个A$位可能会搞砸,因为它是一个特殊的共享)。

回答by user3394651

to solve this you will need: give permission to the board administrator httpd.exe file authenticate the service with an administrator of the User Services pane windows leave the httpd.conf file so

要解决此问题,您需要: 授予董事会管理员权限 httpd.exe 文件 向用户服务窗格的管理员验证服务 窗口离开 httpd.conf 文件,以便

DocumentRoot "//192.168.50.2/g/htdocs"

DocumentRoot "//192.168.50.2/g/htdocs"

set the ip of the host where the files for this machine name by apache does not recognize

设置 apache 无法识别此机器名称的文件的主机的 ip