Skip to content

Latest commit

 

History

History
83 lines (52 loc) · 4.21 KB

README.md

File metadata and controls

83 lines (52 loc) · 4.21 KB

Nginx

Docker Pulls Back project

Nginx running on alpine linux.

Tags

The image is built automatically via CI, using latest alpine as base image.

Images can be found at:

  • Docker hub: jitesoft/nginx
  • GitLab: registry.gitlab.com/jitesoft/dockerfiles/nginx
  • GitHub: ghcr.io/jitesoft/nginx
  • Quay: quay.io/jitesoft/nginx

Dockerfile

Dockerfile can be found at GitLab and GitHub

Usage

Most basic usage is to just run the container, nginx will start and serve the content in the /usr/local/nginx/html directory.
Port 80 is exposed by default.

www-data user

The www-data user have the same id as the www-data user in the most common alpine images, 82.
Before 2021 07 23, the id was 1000, which created issues with read/write permissions when used with the jitesoft/php image.

Containers created runs as root (easily changed in production with the appropriate flags), while the nginx process runs as the www-data user (82) by default.

Template

To ease the setup process, the startup script will generate a default.conf file in the /etc/nginx/conf.d directory. Any files in said directory will be loaded into nginx by default.
When the template is generated, the script will run envsubstr to replace all template vars with passed environment variables. If you wish to customise the template you may create a new template and set the CONF_TEMPLATE variable to the path of the file and use ${VARIABLE} placeholders to replace those with the named env variables passed.

The default template file is located at /usr/local/default.template and exposes LISTEN_PORT, SERVER_NAME and SERVER_ROOT env variables and defaults to 80, localhost and /usr/local/nginx/html.

It's also possible to change the full initial nginx configuration by replacing the /etc/nginx/nginx.conf file, while not recommended (rather create a new file to override in /etc/nginx/conf.d).

Healthcheck

By default, the container will run a health check - via the healthcheck shell script - every 30 seconds.
The health check script uses wget to hit a special endpoint (127.0.0.1:3999/__health), which is automatically created in the /etc/nginx/conf.d/000-healthcheck.conf configuration.
It's possible to turn the healthcheck off by setting SKIP_HEALTHCHECK=true as an env variable. The healthcheck will still run, but always return as healthy.

Changing the healthcheck scripts is possible, while not recommended.

Licenses

Dockerfiles and other scripts in the repository is released under the MIT license

Nginx is released under 2-clause BSD-like license.

Image labels

This image follows the Jitesoft image label specification 1.0.0.

Sponsors

Sponsoring is vital for the further development and maintaining of open source projects.
Questions and sponsoring queries can be made via email.
If you wish to sponsor our projects, reach out to the email above or visit any of the following sites:

Open Collective
GitHub Sponsors
Patreon

Jitesoft images are built via GitLab CI on runners hosted by the following wonderful organisations:

Fosshost logo

The companies above are not affiliated with Jitesoft or any Jitesoft Projects directly.