12

I wonder if there is an existing module that can help in the subject. I am not looking for a caching module (like Boost or Varnish), but a way to export my whole site (or only certain pages) into static. The idea is that I want my web server will be a very simple and light and will only serve static files (html/css/js) - no database on production, no php engine will be installed on server. All the Drupal engine will be on another server, export will be done each time adding/editing/changing a node or view, and a new set of html files will be created in a directory structure. These files will later on be copied to the production site that will serve always and only static files, no .htaccess that will check requests if file exist etc.

Is there a module for that, or a workaround that this can be achieved with Drupal?

Thanks

5 Answers 5

5

I use HTTrack for this, also there's this article on drupal.org: Creating a static archive of a Drupal site.

1
  • Thanks, I've heard about it, as I just replied to Oswald. I'll read the article in your link, thanks. Aug 9, 2011 at 13:47
2

There is a new Drupal 7 module providing this functionality is Static Generator

Static Generator:

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.

1

GNU wget is a WWW client that can download the pages of your site and store them locally. Use the -r option to download pages recursively (i. e. follow links to pages on the same site found on the current page). It can also convert absolute URLs to relative one (using the -k option).

1
  • Yes, I know the wget option, in that manner there is even better WWW client which called HTTrack . I wondered if there is a built in feature for Drupal that can add let's say sort of a button in each page that will export page to static version etc. Thanks Aug 9, 2011 at 13:46
0

I'm looking for something similar. I've searched the modules and found the following options, but haven't looked into either of them yet:

We want to use S3 or another static file serving CDN service for our site, so it's possible something more like the following will be helpful:

Another thought is that it may be possible to leverage a caching framework like boost and add something to push the files to production as it caches them.

0

You can use module Wget Static - Generate HTML and Save To FTP / Webdav, which exactly does what you want. Infact, I have also deployed the same architecture as you have discussed just above.

You can select content for static HTML generation, which can also be bypassed using query parameters. Then the second part comes where you perform static html generation using WGET application. This Wget Static Module almost covers all the options necessary for Static Data Generation.

Not only this, finally beside downloading that generated static html, you have option to either save it to FTP server or Webdav Server, which again supports Two factor Authentication.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.