This Dockerfile is intended to be used as a base for any web servers within Lagoon.
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
envplate with a container-entrypoint.
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.
Here's an example showing how to redirect
example.com and preserve the request:
RUN echo "~^www.example.com http://example.com\$request_uri;" >> /etc/nginx/redirects-map.conf
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.
COPY redirects-map.conf /etc/nginx/redirects-map.conf
If you want to protect your site via basic authentication, you can do this by defining the environment variables
BASIC_AUTH_PASSWORD within your
.lagoon.env.environment files. For further explanation on how to set up Environment Variables on Lagoon, check here.
Environment variables are meant to contain common information for the
By not setting
Username for basic authentication
Password for basic authentication (unencrypted)
If set to