5.2 ConfigurationHow does the server know which files to parse, and which ones to return without parsing? From the information in the server configuration files, of course. Let's look at how we can configure SSI on the NCSA server. The first thing you need to set is the extension(s) for the files that the server should parse in the server configuration file (srm.conf). For example, the following line will force the server to parse all files that end in .shtml:
AddType text/x-server-parsed-html .shtml Internally, the server uses the text/x-server-parsed-html MIME content type to identify parsed documents. An important thing to note here is that you cannot have SSI directives within your CGI program, because the server does not parse the output generated by the program. Alternatively, you can set the configuration so that the server parses all HTML documents:
AddType text/x-server-parsed-html .html However, this is not a good idea! It will severely degrade system performance because the server has to parse all the HTML documents that it returns. Now let's look at the two configuration options that you must set in the access configuration file (access.conf) that dictate what type of SSI directives you can place in your HTML document:
Here is how you would enable both Includes and Exec:
Options Includes ExecCGI To exclusively enable Includes without Exec, you need to add the following:
Options IncludesNoExec Before enabling either of these features, you should think about system security and performance. Configuring SSI for the CERN ServerAs we mentioned at the beginning of this chapter, not all servers support SSI. However, you can use a Perl program called fakessi.pl to emulate SSI behavior. For example, on the CERN server, all you need to do is:
Exec /*.shtml /usr/local/etc/httpd/cgi-bin/fakessi.pl (assuming that /usr/local/etc/httpd/cgi-bin is the directory that fakessi.pl was installed into). This tells the server to execute fakessi.pl whenever a client requests a file ending in .shtml. You can get fakessi.pl from http://sw.cse.bris.ac.uk/WebTools/fakessi.html. |
|