我在 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?
发布评论
评论(4)
您需要使用正斜杠而不是反斜杠,或者使用额外的反斜杠将它们全部转义,并将路径括在引号中,如 Xophmeister 所述。例如:
或者
您使用 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:
or
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.
caltor 是对的,这里稍作编辑,您可以使用
因为它有别名。但是我讨厌在配置中写网络驱动器,如
//p...
这里还出现了另一个问题,在这种方法中,你无法执行 exec() 或批处理文件,无法获取目录信息, open_dir 等无法返回结果,apache 也无法作为服务启动。要解决这个问题,
首先下载
http://technet.microsoft.com/en-us/sysinternals/bb842062.aspx
将 zip 文件解压到 C:/sys。
打开cmd,
然后出现一个新的命令行。您所需要的
只是询问 Lethea 电脑的用户名和密码。
这里是 j:网络驱动器的短名称。
执行此操作后,在 httpd.conf 文件夹中
您不需要创建别名或将完整的网络映射写入 Documentroot 和目录
...
caltor is right , little edit here , you can use
<Directory "/p">
cause it has alias.ButI hate writing network drive in config like
//p...
alsoThere 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
then a new command line appears . All you need
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
...
为什么不直接使用 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, theA$
bit is probably screwing things up as it is a special share).要解决这个问题,您将需要:
授予板管理员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