Thanks for the answer, Knute,

However I have already set ServerRoot to "C:/Program Files/Apache" and 
DocumentRoot to 'htdocs", therefore  I assume it implies the document root will 
be "C:/Program Files/Apache/htdocs", as indicated in your reply, correct?

The question is why  I have to use <Directory "C:/Program Files/Apache/htdocs"> 
instead of <Directory "htdocs"> even though DocumentRoot is already set to 
"htdocs"?


On Nov 29, 2012, at 3:29 PM, Knute Johnson wrote:

> On 11/29/2012 3:10 PM, Alex Chen wrote:
>> I downloaded the Apache 2.2.22 Windows msi and installed it as a console 
>> app,  I copied all the files to C:/Program Files/Apache and uninstalled 
>> Apache to have a stock copy of the installation.
>> I made the following changes in httpd.conf.
>> 
>> ServerRoot  "C:/Program Files/Apache"
>> Listen 8080
>> LoadModule ssl_module modules/mod_ssl.so
>> DocumentRoot "htdocs"
>> ErrorLog "logs/error.log"
>> 
>> <Directory "htdocs">
>>     Options Indexes FollowSymLinks
>>     AllowOverride None
>>     Order allow,deny
>>     Allow from all
>> </Directory>
>> 
>> When I used IE to access http://localhost:8080, I got the following error:
>> Forbidden
>> 
>> You don't have permission to access / on this server.
>> 
>> Apache/2.2.22 (Win32) mod_ssl/2.2.22 OpenSSL/1.0.1c Server at localhost Port 
>> 8080
>> 
>> I saw the following entry in error.log
>> [Thu Nov 29 14:15:39 2012] [error] [client 127.0.0.1] client denied by 
>> server configuration: C:/Program Files/Apache/htdocs/
>> 
>> However if I changed the directory setting to the followings, it worked fine 
>> even though the DocumentRoot setting remained the same.
>> 
>> <Directory "C:/Program Files/Apache/htdocs">
>>     Options Indexes FollowSymLinks
>>     AllowOverride None
>>     Order allow,deny
>>     Allow from all
>> </Directory>
>> 
>> It seems that the DocumentRoot directive accepts a relative path name but 
>> the <Directory> structure requires the full path, is that the case?
>> 
>> Alex
> 
> This directive sets the directory from which httpd will serve files. Unless 
> matched by a directive like Alias, the server appends the path from the 
> requested URL to the document root to make the path to the document. Example:
> 
> DocumentRoot /usr/web
> 
> then an access to http://www.my.host.com/index.html refers to 
> /usr/web/index.html. If the directory-path is not absolute then it is assumed 
> to be relative to the ServerRoot.
> 

> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org
> For additional commands, e-mail: users-h...@httpd.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org
For additional commands, e-mail: users-h...@httpd.apache.org

Reply via email to