Note: You are currently viewing documentation for Moodle 2.2. Up-to-date documentation for the latest stable version is available here: Apache.

Apache: Difference between revisions

From MoodleDocs
No edit summary
Line 14: Line 14:


===Apache 2.x===
===Apache 2.x===
(Note that these instructions may only apply to Debian Linux. Users of other systems should check their documentation to check that mod_expires is loaded)


from the command line:
from the command line:

Revision as of 12:20, 27 June 2006

When most people refer to Apache they are talking about the "Apache HTTP Server Project". In fact Apache is really the "Apache Software Foundation" which hosts a long list of projects of which the HTTP server is just one, albeit the best known.

The Apache HTTP Server enables web pages to be published on the internet (or an intranet or even on a single test machine). It is tightly linked with the PHP scripting language in which Moodle is developed. A web server is a required component of a Moodle installation. There are two distinct developments of the Apache HTTP Server, version 1 and version 2. Although version 2 should have replaced version 1, the architectures are so different that they both continue to be supported. Either are fully supported by Moodle.

The Apache HTTP Server Project describes itself thus:

"The Apache HTTP Server Project is an effort to develop and maintain an open-source HTTP server for modern operating systems including UNIX and Windows NT. The goal of this project is to provide a secure, efficient and extensible server that provides HTTP services in sync with the current HTTP standards.

Apache has been the most popular web server on the Internet since April 1996. The November 2005 Netcraft Web Server Survey found that more than 70% of the web sites on the Internet are using Apache, thus making it more widely used than all other web servers combined."

Configuration

If you have the luxury of being able to configure Apache directly, you can achieve a major performance boost by specifying that images, JavaScript and other often-reused elements must be cached locally. This will enormously reduce both page loading time and server load.

Apache 2.x

(Note that these instructions may only apply to Debian Linux. Users of other systems should check their documentation to check that mod_expires is loaded)

from the command line:

a2enmod expires

you can now add the following lines inside the <virtualhost> tags of the relevant file in apache2/sites-enabled

<IfModule mod_expires.c>
  ExpiresActive On
  ExpiresDefault "access plus 1 seconds"
  ExpiresByType text/html "access plus 1 seconds"
  ExpiresByType image/gif "access plus 120 minutes"
  ExpiresByType image/jpeg "access plus 120 minutes"
  ExpiresByType image/png "access plus 120 minutes"
  ExpiresByType text/css "access plus 60 minutes"
  ExpiresByType text/javascript "access plus 60 minutes"
  ExpiresByType application/x-javascript "access plus 60 minutes"
  ExpiresByType text/xml "access plus 60 minutes"
</IfModule>

then restart apache with something like

/etc/init.d/apache2 restart

The downside is that if you're editing your theme, there may be confusion as you'll keep seeing the old images instead of the new ones. Clicking 'refresh' in the browser or clearing the cache should sort this out.

more information

See also