This Dockerfile is intended to be used as a base for any web servers within Lagoon.
The default exposed port of NGINX containers is port
This image is prepared to be used on Lagoon. There are therefore some things already done:
- Folder permissions are automatically adapted with
fix-permissions, so this image will work with a random user.
- The files within
/etc/nginx/*are parsed through
envplatewith a container-entrypoint.
NGINX configuration (
If you need PHP, have a look at the
php-fpm image and use
php-fpm in tandem.
Build the content during the build process and inject it into the
In order to create redirects, we have
redirects-map.conf in place. This helps you to redirect marketing domains to sub-sites or do non-www to www redirects. If you have a lot of redirects, we suggest having
redirects-map.conf stored next to your code for easier maintainability.
If you only have a few redirects, there's a handy trick to create the redirects with a
RUN command in your
Here's an example showing how to redirect
example.com and preserve the request:
To get more details about the various types of redirects that can be achieved, see the documentation within the
After you put the
redirects-map.conf in place, you also need to include it in your
nginx.dockerfile in order to get the configuration file into your build.
Basic authentication is enabled automatically when the
variables are set.
Automatic basic auth configuration is provided for convenience. It should not be considered a secure method of protecting your website or private data.
Some options are configurable via environment variables.
|BASIC_AUTH_USERNAME||(not set)||Username for basic authentication.|
|BASIC_AUTH_PASSWORD||(not set)||Password for basic authentication (unencrypted).|
|FAST_HEALTH_CHECK||(not set)||Set to