How to Configure Apache for Javascript

Techwalla may earn compensation through affiliate links in this story.
Apache Web Server configurations

JavaScript is used to create dynamic web pages that include pop up menus and animations on HTML pages. If the web pages are to be run on an Apache web server, then the Apache server needs to be configured for Server Side Includes (SSI). This functionality allow servlets or small server side code snippets to communicate with the browser programs called applets and can even be used to generate complete web pages. In Apache this functionality is enabled by editing the "httpd.conf" file.


Configuring httpd.conf

Step 1

Fire up your Apache web server. Since the Apache web server comes as a bundle of other third-party server software in most cases, all you will need to do is fire up the bundled application to activate the Apache server inside.


Video of the Day

Step 2

Locate the server icon on the taskbar if you are using a local-based server. This icon will show all the services running. Click once to bring the menu and locate the Apache folder.

Step 3

Locate the server configuration folder if you are using a remote server. Locate the PHP folder which will contain the "httpd.conf" file.


Step 4

Search for the string "AddHandler" and re-write it to read this way:

AddHandler server-parsed .shtml

Step 5

Create a entry and enable the Includes feature as follows:


<Directory "/var/www">

Options Indexes Includes followSmyLinks AllowOverride All Order allow, deny Allow from all


Step 6

Ensure that all your files containing some JavaScript or a server-side include have an .shtml extension.

Step 7

Use the entry to allow for all web pages with a JavaScript include to be executed as follows:



DocumentRoot /var/www/eHow ServerName XBitHack On ErrorLog logs/eHow_log CustomLog logs/eHow_log common

Step 8

Save all the changes and refresh the page to test.


It is good programming practice to comment any changes made to the config files with the person’s initials, data and a brief description of the changes made.

Since most configurations allow for overriding, it is advisable to apply the “Options + Includes” arguments to a specific directory to ensure that it gets evaluated last.

Another way of parsing or telling Apache which files contain the JavaScript Includes is to do it this way:

AddType text/html .shtml

The “XBitHack on” method tells Apache to parse files that have the execute bit set and is initiated using the “chmod” command as shown below:

Chmod +x eHow.html

Additional configuration arguments can be found inside the “httpd.conf” comment files that specify how filenames and tags should be used.



Report an Issue

screenshot of the current page

Screenshot loading...