Apache 网络驱动器别名

发布于 2024-12-04 18:07:21 字数 459 浏览 0 评论 0 原文

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

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

别名 /p \\ps-file.server_location.edu\A$
<目录 /p>
订单允许、拒绝
允许所有
< /目录>

但是,每当我尝试访问 localhost/p 时,我都会收到一条 403 禁止消息,指出您无权访问此服务器上的 /p。有什么建议吗?

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

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

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

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:

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

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

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

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

≈。彩虹 2024-12-11 18:07:21

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

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

或者

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

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

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:

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.

木槿暧夏七纪年 2024-12-11 18:07:21

caltor 是对的,这里稍作编辑,您可以使用 因为它有别名。但是
我讨厌在配置中写网络驱动器,如 //p...

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

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

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

然后出现一个新的命令行。您所需要的

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

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

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

...

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

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,

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

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

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

...

素染倾城色 2024-12-11 18:07:21

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

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).

拥醉 2024-12-11 18:07:21

要解决这个问题,您将需要:
授予板管理员httpd.exe文件权限
向“用户服务”窗格窗口的管理员验证服务
保留 httpd.conf 文件,以便

DocumentRoot "//192.168.50.2/g/htdocs"

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

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

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文