This project is not covered by Drupal’s security advisory policy.

The static module generates a complete copy of your website in html form including all js, css, images and other assets. This can then be transferred to run the website from a simple web server without PHP, MySQL or memcache.

Benefits

  • Performance - No PHP, Mysql, etc on public facing site. Everything is a static file so it is served very quickly.
  • Security - The static version of the site does not have a database, user accounts or any other form of user interaction (except 3rd party integrations) so it is much more secure.
  • Reliability - Most of the usual failure points are gone. PHP, MySQL, memcache, varnish, etc are no longer part of the static site.

Limitations

Due to the fact that there is no database or PHP behind the website, any functionality that requires it can't be used. 3rd part libraries can fill in most of the needed functionality.

Some of the parts that can't be used are:

  • No views filters
  • Drupal comments
  • Drupal search.
  • No drupal forms.
  • No context (not the module) - meaning you can't change the page contents based on the user unless you do it in javascript.
  • No ajax callbacks (except pre-generated GET requests)

Pagers DO work as long as they are passed through hook_preprocess_pager.

Use cases

Static website - There is a class of website that is built in Drupal but is rarely if ever updated. There are no “community” bits to it like comments and webforms. For this type of website, you can use the static module to periodically export your entire Drupal site to static html that can be uploaded to a simple server without PHP, MySQL, memcache or anything other than a web server. If changes need to be made, they can be made on a laptop or staging server and then exported and uploaded again. This allows both viewing the full site for acceptance testing before it goes live and all of the performance and security gains of a static website.

Archive website - A similar type of website is an archival site such as the various DrupalCon and DrupalCamp websites. While they no longer need to be live Drupal sites or be updated, they should still be accessible to see the content that was there. In the same way as simple Static websites, archived websites can be generated, uploaded and then left alone.

Hybrid Static/Dynamic - Drupal can be installed behind a firewall and a static site periodically generated and copied over to a public web server. This would allow content writers to create, update and delete content within Drupal. These changes are tracked and within a short period of time it would be generated and transferred to the public facing site. Essentially it would have the power of content editing in Drupal but be hosted to the public as static HTML.

Integrations

The static module integrates with several modules to enhance its functionality.

Expire - The expire module is used to tell the static module which pages need to be re-generated.

ESI - The esi module can be used to render parts of the page as Edge Side Includes. This allows partial page updates for example, footers, main menus and other parts that are shared and frequently updated.

How is this different than boost?

The boost module is a caching system for Drupal. It generates html files that are served instead of having Drupal process the page again. The static module will generate an entire site that can be run separately from Drupal and does not require Drupal at all once it has been generated.

Supporting organizations: 
Development Sponsor

Project information

Releases