Skip to content

bfren/docker-nginx

Repository files navigation

Docker Nginx

GitHub release (latest by date) Docker Pulls Docker Image Size GitHub Workflow Status

Docker Repository - bfren ecosystem

A simple Nginx base image - no SSL support etc, designed to be used behind a proxy server.

Files are served from /www/public (which can be overridden using BF_NGINX_PUBLIC_OVERRIDE).

Contents

Ports

  • 80

Volumes

Volume Purpose
/www Files in this directory are served by Nginx (if not mapped, a 'Welcome to Nginx' message will be served).

Environment Variables

Variable Values Description Default
BF_NGINX_FORWARD_ACCESS_LOG 0 or 1 If 1, the access log will be forwarded to Docker's stdout. 0
BF_NGINX_HEALTHCHECK_URI URI The URI to load during the healthcheck. http://localhost
BF_NGINX_IGNORE_FAVICON 0 or 1 If 1, a helper configuration file will contain a directive to return 204 (No Content) when a favicon is requested. 1
BF_NGINX_PUBLIC_OVERRIDE string If set, it will be used as the nginx root directory (which by default is /www). blank

Helper Functions

Function Arguments Description Usage
healthcheck None Loads BF_NGINX_HEALTHCHECK_URI to check everything is working. docker exec <<CONTAINER>> healthcheck
nginx-reload None Tests Nginx configuration and if successful, reloads the Nginx server. docker exec <<CONTAINER>> nginx-reload

Nginx Configuration Helpers

The image contains a handful of useful Nginx configuration 'helper' files, which you can find in /overlay/etc/nginx/helpers. They all begin with the prefix 'nginx':

Helper Description
-base.conf Basic configuration, sets listen port, document root, and adds the GNU Terry Pratchett header.
-ignore-favicon.conf Returns 204 for favicon.ico requests that do not exist, and stops it being added to the error log.
-error-pages.conf Include if you want to use Nginx's default error pages.
-static-files.conf Sets useful headers, cache, and expiration values for serving static files.
-uploads.conf Sets client_max_body_size to 0 - so there is no limit on file upload size.

Licence

MIT

Copyright

Copyright (c) 2020-2024 bfren (unless otherwise stated)