Chapter 9. Delegated control
<Directory>
Applying a specialised set of commands just to a subdirectory of a web site from the
httpd.conf file.
Include
Splitting the main configuration file into components.
AccessFileName
Nominating a filename to handle control from the directory itself.
AddDescription
A commonly used command in the delegated configuration files to set the Descrip-
tion column in automatic indexes.
AllowOverride
Controlling what can be delegated
The user directory example was the first where we were passing control outside our
tidy document root. It may well be that we want a different configuration for these,
relatively uncontrolled, areas.
There are a number of aspects to this. You must decide what defaults you want
passed to these areas and what you want absolutely fixed. You also need to know
how to override the defaults where permitted.
We will start by noting how to change settings from within the httpd.conf file for
a directory tree. In our current configuration file the directory index file name is
index.html. Suppose for a subdirectory of one of our web sites we wanted to change
it to be main.html. How would we do that?
<VirtualHost *>
ServerName cheese.dept.cam.ac.uk
DocumentRoot /var/www/CHEESE
CustomLog logs/cheese_log clr
<Directory /var/www/CHEESE/bestiary>
DirectoryIndex main.html index.html
</Directory>
</VirtualHost>
Figure 9-1. httpd.conf: Using the <Directory> command
The <Directory dir> ... </Directory> identifies a series of commands which
should override or enhance the general settings for a specific subdirectory,
/var/www/CHEESE/bestiary in the example given in the figure.
In the case of commands we have met, it is easy to imagine simply issuing them again
within a <Directory> block to override the previous settings. But what about turning
features on or off? A common example is to turn on or off the automatic generation
of indexes.
At the moment we can see the index of the games directory in the
cheese.dept.cam.ac.uk web site.
65
Comentários a estes Manuais