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

Apache: Difference between revisions

From MoodleDocs
No edit summary
Line 33: Line 33:


The effect is to make everything stay in the cache except HTML and XML, which change dynamically. It's possible to gain a several hundred percent decrease in load times this way
The effect is to make everything stay in the cache except HTML and XML, which change dynamically. It's possible to gain a several hundred percent decrease in load times this way
More info: [http://www.metaskills.net/blog/heuristics/sysadmin/how-to-control-browser-caching-with-apache-2 www.metaskills.net]


== See also ==
== See also ==

Revision as of 13:53, 12 October 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). The PHP scripting language, in which Moodle is developed, is tightly integrated with the Apache HTTP Server. 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 PHP and 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."

Installing Apache

Usually Apache is installed alongside PHP and MySQL in a combination known as AMP, see Installing AMP for details.

Performance

Apache can be tuned to make pages load faster by specifying how the browser should cache the various page elements. How to do this varies slightly between OSes but there are two basic steps

  1. Install and enable mod_rewrite - refer to documentation or man pages
  2. Add this code to the virtual server config file within the section for the root directory (or within the .htaccess file if AllowOverrides is On):
<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 1 seconds"
</IfModule>

The effect is to make everything stay in the cache except HTML and XML, which change dynamically. It's possible to gain a several hundred percent decrease in load times this way

More info: www.metaskills.net

See also