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?
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.
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">
...
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).
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
来源:https://stackoverflow.com/questions/7431658/apache-network-drive-alias