Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

Previous Chapter 5
Server Side Includes
Next
 

5.2 Configuration

How 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:

  • If you want to embed SSI directives to display the environment variables and file statistics in your HTML documents, you need to enable a feature called Includes.

  • If you want to have the ability to execute external programs (CGI as well as other system applications) from within your HTML documents, you need to enable the Exec feature.

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 Server

As 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:

  1. Install fakessi.pl into the cgi-bin directory.

  2. Add the following directive to httpd.conf:

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 https://sw.cse.bris.ac.uk/WebTools/fakessi.html.


Previous Home Next
Introduction Book Index Environment Variables

 
 
  Published under free license. Design by Interspire