Enable WordPress maintenance mode

Create a .maintenance file and include the following:

<?php $upgrading = 1455233470; ?>

Place the file in the root of a WordPress installation.

The number is a UNIX timestamp. If the timestamp is less than 10 minutes ago, the “maintenance mode” screen will be displayed. After 10 minutes, WordPress bypasses maintenance mode and loads the site as normal.

Maintenance mode will also be bypassed if the file exists but is empty.

Use Apache Redirect for simple redirects

Sometimes mod_rewrite is overkill and you just need a simple redirect put in place:

<IfModule mod_alias.c>
  Redirect "/foo/" "/bar/"
</IfModule>

So a request for “/foo/” returns a HTTP status code 302 (temporary redirect) pointing to “/bar/”.

Refs: https://httpd.apache.org/docs/2.4/mod/mod_alias.html#redirect

Enable SSL on nginx

Somehow I’ve used nginx for years but never got around to setting up HTTPS on it until now.

Luckily it’s very simple. Here are the unique bits. Everything else was a pretty standard nginx server block:

server {
  listen 443 ssl;
  ssl on;
  ssl_certificate /path/to/certificate;
  ssl_certificate_key /path/to/key;
  # ...
}

Refs: http://nginx.org/en/docs/http/configuring_https_servers.html

Tidbits

  • Jekyll’s highlight feature accepts “apache” and “nginx” as languages.
  • Safari doesn’t understand transform, have to use -webkit-transform.