Symbolic links. It is demonstrated that the web server does not follow symbolic links unless explicitly directed to do so.
Options FollowSymLinks. The instruction to make the server follow symbolic links is introduced.
Options. There is general discussion about the Options command.
Options SymLinksIfOwnerMatch. The more restrictive command is also introduced.
We can now see the index.html file as expected but if we create a symbolic link called main.html to index.html and ask for that we get a failure.
$ cd /srv/www/WWW/ $ ln -s index.html main.html $ ls -l ls -l total 4 -rw-r--r-- 1 root www-admin 306 2007-02-21 17:34 index.html lrwxrwxrwx 1 root www-admin 10 2007-02-21 18:36 main.html -> index.html
When we try to access the symbolic link we get a 403 "Forbidden" error. The web server has found the symbolic link but has decided not to follow it.
To instruct the web server to follow symbolic links we need to set an option. You will recall we unset all options with Options None in the configuration file. Now we need to turn on one of them.
We can do this with the command Options
FollowSymLinks but this has a certain subtly we need
to understand. The command Options
FollowSymLinks sets the
FollowSymLinks
option and unsets all of the
others. The Options command followed by a
list of options is absolute; precisely the
options specified will be set and no others. For this reason we
will introduce the syntax for setting (and unsetting) individual
options while leaving the others unchanged.
There is an analogous syntax with a minus sign for turning off options while leaving others untouched.
Because symbolic links might be used to circumvent access
controls in the web server there is a modified version of this
option with the rather unwieldy name
SymLinksIfOwnerMatch
. This instructs the web
server to follow the symbolic link if and only if the symbolic
link's owner (typically the user who created it) and the
target's owner match.
It is worth mentioning that effects very similar to those provided by symlinks can also be created using web server facilities by using the Alias command which we cover later in Section 6.3.2. Both have strengths and weaknesses; using both at the same time can be a recipe for madness!
Syntax Summary: The Options command
option1
option2
option3
Set options
option1
,
option2
and
option3
and unset all others.
+option1
+option2
+option3
Set options
option1
,
option2
and
option3
leaving all other options unchanged.
-option1
-option2
-option3
Unset options
option1
,
option2
and
option3
leaving all other unchanged.
+option1
+option2
-option3
Set options
option1
,
option2
and unset
option3
leaving all other unchanged.
Syntax Summary: Options for Symbolic Links
The server will follow any symbolic link.
The server will follow any symbolic link owned by the same user as its target.