sonichy
sonichy

Reputation: 1478

linux apache: what is the difference of DocumentRoot"path" and <Directory "path">?

The httpd.conf has two similar parts below ,what is the difference of DocumentRoot"path" and ?
http://localhost/server-status report: You don't have permission to access /server-status on this server.
error_log report: client denied by server configuration:/host/HY/PHP/server-status

ServerName localhost
DocumentRoot "/host/HY/PHP"
<Directory />
    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all
</Directory>

<Directory "/host/HY/PHP">
    Options Indexes FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>

Upvotes: 0

Views: 112

Answers (1)

Capsule
Capsule

Reputation: 6159

To access the server-status, you usually need to enable the status module, and add the correct IPs in the Allow from line.

Something like:

<Location /server-status>
    SetHandler server-status
    Order deny,allow
    Deny from all
    Allow from 127.0.0.1 ::1 X.X.X.X
</Location>

DocumentRoot is the folder Apache will scan when accessing / on your server. This is where you should put your documents, but you'll never see a server-status folder here, if this is the underlying question. The server-status URL is completely virtual.

<Directory ...> allows you to define certain settings on a folder level and not a global Apache level.

Hope that makes sense.

Upvotes: 1

Related Questions