The MOOSE web hosting stack is based upon:
- nginx — for HTTP and HTTPS connectivity, and serving static files
- Varnish — for accelerating and caching dynamic content
- Apache — a widely-deployed web server included in the stack to simplify
.htaccess
support - PHP — arguably the most popular server-side web programming language
- MySQL — and arguably the most popular server-side relational database
We’ve augmented these with a number of self-service scripts, as well as:
- simp_le — for automatic renewal of LetsEncrypt certificates
- the MOOSE scripts — see below
- scponly — for restricting SFTP access to websites’ folders
MOOSE Scripts
moose.addsite
moose.sslsite
Guidance for Specific Content Management Systems
WordPress
We recommend adding this to your wp-config.php
file, just before the “stop editing” comment:
define('FS_METHOD', 'direct');
if (strpos($_SERVER['HTTP_X_FORWARDED_PROTO'], 'https') !== false)
$_SERVER['HTTPS']='on';
The first line will enable through-the-web theme and plugin installs/updates.
The last two lines detect when nginx is terminating the connection with HTTPS, and treats the session accordingly. If you find that your site ends up with “too many redirections” after enabling HTTPS then make sure you have included these tweaks, and set the siteurl
and home
options to begin https://
.
Drupal 7
Consider adding the following to your settings.php
file, right at the end:
if (strpos($_SERVER['HTTP_X_FORWARDED_PROTO'], 'https') !== false)
$_SERVER['HTTPS']='on';
Drupal 8
This should be handled by ReverseProxyMiddleware.php
within Drupal 8.