2. Table of Contents
2
Apache Handlers
Built-in Handlers in Standard
Distribution
Function of Apache Handlers
Creating an Apache Handler
How to Remove an Apache
handler?
Modifying Static Content
Using a CGI Script
Files with HTTP Headers
3. A handler refers to an internal Apache representation of the action that is to be performed at the time
when a file is called. Usually, files have implicit handlers, depending on the file type. Generally, the files
are served by the server but there are certain types of files that are handled separately.
It is possible to configure handlers explicitly, depending on either filename extension or on location,
without any relation to file type.
Handlers can either be included in a module or be built into the server, or these can be added with the
Action directive.
3
Apache Handlers
4. The built-in-handlers in the standard distribution of cPanel are mentioned below.
default-handler - It sends the file and uses the default handler of Apache for static content.
send-as-is - It sends the file with HTTP headers intact.
cgi-script – It handles the file as a CGI script.
imap-file – It parses the file as an imagemap rule file.
server-info – It retrieves the configuration information of the server.
server-parsed – Parses the file for server-side includes.
server-status – It retrieves the status report of the server.
type-map – Parses the file as a type map file.
4
Built-in Handlers in Standard Distribution
5. Apache handlers control the way in which a site’s Apache web server software manages certain types
of files and their extensions. CGI scripts and server-parsed files are handled by Apache.Apache can be
configured for using an existing handler for the purpose of handling a new file type. For this purpose,
you need to add manually the handler and the extension in the interface.
To digress, with regard to web servers,VPS (Virtual Private Servers) are in high demand due to the
benefits that they offer. Professional web hosting companies, including HTS Hosting, provide Windows
ManagedVPS, Linux ManagedVPS,Windows Self-ManagedVPS, and Linux Self-Managed VPS.
5
Function of Apache Handlers
7. You need to carry out the following steps for adding an Apache handler:
Enter the handler name in the text box, Handler.
Enter the file extension in the text box, Extension(s).
A file extension refers to the letters after the dot (.) in a file name.
Space-separate multiple extensions.
Click Add.
It needs to be mentioned here that the interface does not let you create custom Apache handlers
7
Creating an Apache Handler
8. You need to carry out the following steps in order to remove a user-defined handler:
Click Delete, that is under the Remove heading, for the appropriate handler in the User Defined
Apache Handlers table.
ClickYes.
It needs to be specified that you cannot remove those file extensions that are handled automatically by
Apache.
8
How to Remove an Apache handler?
9. The below-mentioned directives will result in the requests for files with the html extension to trigger the
launch of the footer.pl CGI script.
Action add-footer /cgi-bin/footer.pl
AddHandler add-footer .html
Post that, the CGI script has the responsibility of sending the document that was requested originally, which
is pointed to by the PATH_TRANSLATED environment variable. It is also responsible for ensuring that the
desired modifications or additions take place.
9
Modifying Static Content Using a CGI Script
10. The send-as-is handler gets enabled by the following directives:
<Directory "/web/htdocs/asis">
SetHandler send-as-is
</Directory>
The send-as-in handler processes all files in the /web/htdocs/asis/ directory, regardless of their filename
extensions.
.
10
Files with HTTP Headers