Hosting Websites for Free

There seem now to be a number of free services that allow you to host static websites, however as static websites seem to be a little bit old hat I’ve not paid them much attention, until now.

It occurred to me that it’s possible to generate a static website from a dynamic site (like WordPress), then automatically mirror the static version to a free static hosting account, maybe updating it daily.

Pro’s

  • It’s free
  • It’s super quick and very resilient to DDOS attacks etc
  • You don’t need a (relatively expensive) WordPress server on the Internet (desktop will do)
  • It’s unhackable (directly) because it’s just static pages

Con’s

  • You (initially) lose dynamic features like logging in, comments, feedback forms
  • … ?

Experiment

Process as follows;

  • Set up an experiment using my recently created Local WordPress / Containers setup.
    (as documented in the HOWTO’s)

  • Added the simply static plugin to generate a static version of the site in a local folder.

  • Created a GitLab project

  • Added the local folder containing the static folder to the GitLab project.

  • Created a new project in CloudFlare Pages (which is one of the aforementioned free services)

  • Created a new CloudFlare project

  • Connected the CloudFlare project to the GitLab project

  • Clicked Publish

Results

On the static version I turned off the preloader to make the loading speed more visible. Would be interested in feedback / how it looks to others.

  • better with / without pre-loader?
  • is the speed noticeable?
  • apart from feedback forms, any noticeable downsides?

Updating the (static) site involved making a change on WordPress, then clicking Deploy in Simply Static … (the rest is done with automated hooks) … total publication (update) time on a small site like that seems to be around 1-2 mins.

Might try it on Linux.uk, although it’s a larger site … maybe be somewhat slower to update …

Edit: static version of Linux.uk

linux

The static version looked the same as the dynamic one but loaded much quicker.

K

Ok, I’ve converted a few sites now so they work locally on my box in terms of updates, but at the same time I’m pushing them out as static sites hosted on CloudFlare pages. Specifically;

What I really wanted to do was to move the Linux Website to static hosting, because it’s pretty slow and not ideally suited to being exposed to users and in particular crawlers. (and it has something line 10,000 pages and takes up around 700Mb)

However. For a Wordpress site, there are feedback forms, subscription forms, newsletter subscriptions and post comments, which won’t work on a straight static site - because there’s no Wordpress server on the far end to process form submissions. This means that (a) the original site still needs to be “available” somewhere to process the form submissions and (b) the static site needs to have some mangled redirects such that anything dynamic (like form submissions) still points at the actual Wordpress Site.

I did try the Wordpress plugin which seems to be recommended for generating static sites (which has 40,000 active installations). Whereas it worked for a couple of small sites, although not quickly, my estimation of the time it was going to take for the Linux.uk site ran into days, so I decided that was going to be impractical.

As a result I’ve written an external crawler that remotely mirrors the contents of a site (technically any site) I’ve also written a matching Wordpress plugin to handle some of the custom mangling. The combination isn’t yet on the live URL, probably do that in ~ 10 days time. For now I’ve just run the crawler over my local copy of the Linux.uk Wordpress instance, took a little under 13 minutes. :slight_smile:

The results can be seen here; https://linux-c5h.pages.dev/ , I have one slight glitch in that it’s opening each page in a new tab, so I need to explicitly reset the link target for internal links, which should be a line or two to change. The other feature of the crawler is that it uses sitemaps, so re-builds are incremental. But new tabs aside, that new links looks to be pretty quick, and it’s zero maintenance and zero cost.

It’s just occurred to me I could make a static version of this forum and stick it up on the old URL, then have logins redirect to this URL … Hmm … anyway, dynamic website hosting just got real cheap … :wink:

I find it opens each page in the same tab now.

Yeah, I fixed it and ran it again :slight_smile:

Ok, just for the record we’re no longer running a public webserver, so all loads are now being handled by static page providers. For each site we have I now run two instances, one public instance on the live url, then one test instance that runs on something like “test.domain” that I can use for testing. Then the “actual” wordpress instance for each site is running here in the office.

Offsite backups courtesy of borgbase who I’m sure I’ve mentioned before :slight_smile:

Updating seems to be working Ok, the package I’m using just updates the public instance with changes from the local instance, which is pretty efficient. No longer see intermittent DDOS attacks, slowdowns, outages etc, which is pretty cool. Also saving £10 a month by not having a dedicated web server there … then of course it’s all much quicker :slight_smile: