Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/devilbox/docker-nginx-mainline
Devilbox's Nginx mainline (based on official Nginx Docker) [multi-arch]
https://github.com/devilbox/docker-nginx-mainline
devilbox docker docker-container docker-image docker-registry dockerfile nginx nginx-docker nginx-mainline
Last synced: about 1 month ago
JSON representation
Devilbox's Nginx mainline (based on official Nginx Docker) [multi-arch]
- Host: GitHub
- URL: https://github.com/devilbox/docker-nginx-mainline
- Owner: devilbox
- License: mit
- Created: 2016-10-20T17:02:13.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2023-01-08T12:21:03.000Z (almost 2 years ago)
- Last Synced: 2023-08-05T17:12:05.269Z (over 1 year ago)
- Topics: devilbox, docker, docker-container, docker-image, docker-registry, dockerfile, nginx, nginx-docker, nginx-mainline
- Language: Shell
- Homepage: http://devilbox.org/
- Size: 6.48 MB
- Stars: 13
- Watchers: 5
- Forks: 12
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE.md
Awesome Lists containing this project
README
# Nginx mainline
[![release](https://img.shields.io/github/release/devilbox/docker-nginx-mainline.svg)](https://github.com/devilbox/docker-nginx-mainline/releases)
[![Github](https://img.shields.io/badge/github-docker--nginx--mainline-red.svg)](https://github.com/devilbox/docker-nginx-mainline)
[![lint](https://github.com/devilbox/docker-nginx-mainline/workflows/lint/badge.svg)](https://github.com/devilbox/docker-nginx-mainline/actions?query=workflow%3Alint)
[![build](https://github.com/devilbox/docker-nginx-mainline/workflows/build/badge.svg)](https://github.com/devilbox/docker-nginx-mainline/actions?query=workflow%3Abuild)
[![nightly](https://github.com/devilbox/docker-nginx-mainline/workflows/nightly/badge.svg)](https://github.com/devilbox/docker-nginx-mainline/actions?query=workflow%3Anightly)
[![License](https://img.shields.io/badge/license-MIT-%233DA639.svg)](https://opensource.org/licenses/MIT)[![Discord](https://img.shields.io/discord/1051541389256704091?color=8c9eff&label=Discord&logo=discord)](https://discord.gg/2wP3V6kBj4)
[![Discourse](https://img.shields.io/discourse/https/devilbox.discourse.group/status.svg?colorB=%234CB697&label=Discourse&logo=discourse)](https://devilbox.discourse.group)**Available Architectures:** `amd64`, `arm64`, `386`, `arm/v7`, `arm/v6`
[![](https://img.shields.io/docker/pulls/devilbox/nginx-mainline.svg)](https://hub.docker.com/r/devilbox/nginx-mainline)
This image is based on the official **[Nginx](https://hub.docker.com/_/nginx)** Docker image and extends it with the ability to have **virtual hosts created automatically**, as well as **adding SSL certificates** when creating new directories. For that to work, it integrates two tools that will take care about the whole process: **[watcherd](https://github.com/devilbox/watcherd)** and **[vhost-gen](https://github.com/devilbox/vhost-gen)**.
From a users perspective, you mount your local project directory into the container under `/shared/httpd`. Any directory then created in your local project directory wil spawn a new virtual host by the same name. Each virtual host optionally supports a generic or custom backend configuration: **static files**, **PHP-FPM**, **reverse proxy** (with or without **websocket** support)..
**HTTP/2 is enabled by default for all SSL connections.**
For convenience the entrypoint script during `docker run` provides a pretty decent **validation and documentation** about wrong user input and suggests steps to fix it.
| | | | |
|:----------------------:|:------------------:|:-------------:|:--------:|
| Invalid backend string | Backend Suggestion | Invalid Alias | Verified |> ##### ๐ฑ GitHub: [devilbox/docker-nginx-mainline](https://github.com/devilbox/docker-nginx-mainline)
| Web Server Project | Reference Implementation |
|:-------------------:|:------------------------:|
| | |
| Streamlined Webserver images | The [Devilbox](https://github.com/cytopia/devilbox) |**[Apache 2.2](https://github.com/devilbox/docker-apache-2.2) | [Apache 2.4](https://github.com/devilbox/docker-apache-2.4) | [Nginx stable](https://github.com/devilbox/docker-nginx-stable) | Nginx mainline**
----
## ๐ Available Docker tags
[![](https://img.shields.io/docker/pulls/devilbox/nginx-mainline.svg)](https://hub.docker.com/r/devilbox/nginx-mainline)
[`latest`][tag_latest] [`debian`][tag_debian] [`alpine`][tag_alpine]
```bash
docker pull devilbox/nginx-mainline
```[tag_latest]: https://github.com/devilbox/docker-nginx-mainline/blob/master/Dockerfiles/Dockerfile.latest
[tag_debian]: https://github.com/devilbox/docker-nginx-mainline/blob/master/Dockerfiles/Dockerfile.debian
[tag_alpine]: https://github.com/devilbox/docker-nginx-mainline/blob/master/Dockerfiles/Dockerfile.alpine#### Rolling releases
The following Docker image tags are rolling releases and are built and updated every night.
[![nightly](https://github.com/devilbox/docker-nginx-mainline/workflows/nightly/badge.svg)](https://github.com/devilbox/docker-nginx-mainline/actions?query=workflow%3Anightly)
| Docker Tag | Git Ref | Available Architectures |
|----------------------------------|--------------|-----------------------------------------------|
| **[`latest`][tag_latest]** | master | `amd64`, `i386`, `arm64`, `arm/v7`, `arm/v6` |
| [`debian`][tag_debian] | master | `amd64`, `i386`, `arm64`, `arm/v7`, `arm/v6` |
| [`alpine`][tag_alpine] | master | `amd64`, `i386`, `arm64`, `arm/v7`, `arm/v6` |#### Point in time releases
The following Docker image tags are built once and can be used for reproducible builds. Its version never changes so you will have to update tags in your pipelines from time to time in order to stay up-to-date.
[![build](https://github.com/devilbox/docker-nginx-mainline/workflows/build/badge.svg)](https://github.com/devilbox/docker-nginx-mainline/actions?query=workflow%3Abuild)
| Docker Tag | Git Ref | Available Architectures |
|----------------------------------|--------------|-----------------------------------------------|
| **[``][tag_latest]** | git: `` | `amd64`, `i386`, `arm64`, `arm/v7`, `arm/v6` |
| [`-debian`][tag_debian] | git: `` | `amd64`, `i386`, `arm64`, `arm/v7`, `arm/v6` |
| [`-alpine`][tag_alpine] | git: `` | `amd64`, `i386`, `arm64`, `arm/v7`, `arm/v6` |> ๐ Where `` refers to the chosen git tag from this repository.
> โ **Warning:** The latest available git tag is also build every night and considered a rolling tag.## โฐ Features
This repository uses official httpd Docker images and adds a lot of features, logic and autmomation op top. This allows you to feature-toggle certain functionality simply by setting environment variables.
Below is a brief overview about most outstanding features, but I would still advice you to read up on available [environment variables](#-environment-variables), as well as the [architecture](#-architecture) to get the whole picture.
> ๐ For details see **[Documentation: Features](doc/features.md)**
#### Automated mass virtual hosts
* Virtual hosts are created automatically, simply by creating a new project directory (inside or outside of the container). This allows you to quickly create new projects and work on them in your IDE without the hassle of configuring the web server.#### Automated PHP-FPM setup
* PHP is not included in the provided images, but you can enable a remote backend and link it to a PHP-FPM image. This allows you to easily switch PHP versions and choose one which is currently required.#### Automated Reverse Proxy setup
* In reverse proxy mode, you can choose any http or https backend of your likings. This way you can proxy NodeJS, Python, etc. and use the webserver to add SSL in front. It distinguishes between HTTP backends (`http://`, `https://`) and Websocket backends (`ws://`, `wss://`) automatically and configures accordingly.#### Automated SSL certificate generation
* SSL certificates are generated automatically for each virtual host if you choose to enable it#### Trusted HTTPS in all vhosts
* Virtual host SSL certificates are signed by an internal Certificate Authority (or one you provide to the image). That makes it possible to set the CA to trusted and all generated vhosts will automatically have trusted SSL.#### Customization per virtual host
* Each virtual host can individually be fully customized via [`vhost-gen`](https://github.com/devilbox/vhost-gen) templates.#### Local file system permission sync
* File system permission/ownership of files/dirs inside the running container can be synced with the permission on your host system. This is accomplished by specifying a user- and group-id to the `docker run` command.#### Tested with common Frameworks
* Wordpress, Drupal, Laravel, CakePHP, PhalconPHP, Magento, Shopware, Typo3, Yii, Zend and many others.## โ Environment Variables
The provided Docker images add a lot of injectables in order to customize it to your needs. See the table below for a brief overview.
> ๐ For details see **[Documentation: Environment variables](doc/environment-variables.md)**
>
> If you don't feel like reading the documentation, simply try out your `docker run` command and add
> any environment variables specified below. The validation will tell you what you might have done wrong,
> how to fix it and what the meaning is.
Verbosity
DEBUG_ENTRYPOINT
DEBUG_RUNTIME
System
NEW_UID
NEW_GID
TIMEZONE
Nginx
WORKER_CONNECTIONS
WORKER_PROCESSES
Main Vhost
MAIN_VHOST_ENABLE
MAIN_VHOST_ALIASES_ALLOW
MAIN_VHOST_ALIASES_DENY
MAIN_VHOST_BACKEND
MAIN_VHOST_BACKEND_TIMEOUT
MAIN_VHOST_DOCROOT_DIR
MAIN_VHOST_TEMPLATE_DIR
MAIN_VHOST_SSL_TYPE
MAIN_VHOST_SSL_CN
MAIN_VHOST_STATUS_ENABLE
MAIN_VHOST_STATUS_ALIAS
Mass Vhost
MASS_VHOST_ENABLE
MASS_VHOST_ALIASES_ALLOW
MASS_VHOST_ALIASES_DENY
MASS_VHOST_BACKEND
MASS_VHOST_BACKEND_TIMEOUT
MASS_VHOST_DOCROOT_DIR
MASS_VHOST_TEMPLATE_DIR
MASS_VHOST_SSL_TYPE
MASS_VHOST_BACKEND_REWRITE
MASS_VHOST_TLD_SUFFIX
All Vhosts
DOCKER_LOGS
HTTP2_ENABLE
## ๐ Volumes
The provided Docker images offer the following internal paths to be mounted to your local file system.
> ๐ For details see **[Documentation: Volumes](doc/volumes.md)**
Data dir
Config dir
/var/www/default/
/shared/httpd/
/ca/
/etc/httpd-custom.d/
/etc/vhost-gen.d/
## ๐ง Exposed Ports
When you plan on using `443` you must enable SSL via environment variables, otherwise nothing will be listening on that port.
| Docker | Description |
|--------|-------------|
| 80 | HTTP listening Port |
| 443 | HTTPS listening Port |## ๐ก Examples
The documentation provides many copy/paste examples about common use-cases including dummy projects.
The given examples distinguish between two different kinds of setup: The default vhost, which only allows to serve a single project and the mass vhost setup, which allows unlimited vhosts that are created automtically. Both types offer the same set of features and are configured in a similar way, so If you find an example in one kind it is easily applyable to the other kind as well.
> ๐ For details see **[Documentation: Examples](doc/examples.md)**
> ๐ For details see **[Docker Compose: Examples](examples/)**#### Docker
Default vhost
ย ย ย ๐ก Serve static files
ย ย ย ๐ก Serve PHP files
ย ย ย ๐ก Sync local filestem permission
ย ย ย ๐ก Serve PHP files over HTTPS
ย ย ย ๐ก Reverse Proxy NodeJS
ย ย ย ๐ก Reverse Proxy Websocket
Unlimited vhosts
ย ย ย ๐ก Customvhost-gen
template
ย ย ย ๐ก LEMP stack with PHP-FPM and MariaDB
ย ย ย ๐ก Wordpress setup
#### Docker Compose
Default vhost
ย ย ย ๐ก Serve static files
ย ย ย ๐ก Serve PHP files
ย ย ย ๐ก Serve PHP files over HTTPS
ย ย ย ๐ก Reverse Proxy NodeJS
ย ย ย ๐ก Reverse Proxy Python
Unlimited vhosts
ย ย ย ๐ก Serve PHP files over HTTPS
ย ย ย ๐ก Reverse Proxy and PHP-FPM
## ๐ท Architecture
The following diagram shows the basic architecture of this docker image.
> ๐ For details see **[Documentation: Architecture](doc/architecture.md)**
```bash
# mass-vhost # main-vhost only
docker-entrypoint.sh docker-entrypoint.sh
| |
โ โ
supervisord (pid 1) httpd (pid 1)
/ |
/ |
โ โ
start start
httpd watcherd
/ | \
/ | \
โ โ โ
sgn rm create-vhost.sh
httpd vhost | |
| |
โ โ
cert-gen vhost-gen โญข generate vhost
```## ๐ค Sister Projects
Show some love for the following sister projects.
๐ค Project
๐ฑ GitHub
๐ DockerHub
Devilbox
docker-php-fpm
devilbox/php-fpm
docker-php-fpm-community
devilbox/php-fpm-community
docker-mysql
devilbox/mysql
docker-apache-2.2
docker-apache-2.4
docker-nginx-stable
docker-nginx-mainline
devilbox/apache-2.2
devilbox/apache-2.4
devilbox/nginx-stable
devilbox/nginx-mainline
docker-bind
cytopia/bind
## ๐ซ Community
In case you seek help, go and visit the community pages.
๐ Documentation
๐ฎ Discord
๐ช Forum
devilbox.readthedocs.io
discord/devilbox
devilbox.discourse.group
## ๐ง Maintainer
**[@cytopia](https://github.com/cytopia)**
I try to keep up with literally **over 100 projects** besides a full-time job.
If my work is making your life easier, consider contributing. ๐ค* [GitHub Sponsorship](https://github.com/sponsors/cytopia)
* [Patreon](https://www.patreon.com/devilbox)
* [Open Collective](https://opencollective.com/devilbox)**Findme:**
**๐ฑ** [cytopia](https://github.com/cytopia) / [devilbox](https://github.com/devilbox) |
**๐** [cytopia](https://hub.docker.com/r/cytopia/) / [devilbox](https://hub.docker.com/r/devilbox/) |
**๐ฆ** [everythingcli](https://twitter.com/everythingcli) / [devilbox](https://twitter.com/devilbox) |
**๐** [everythingcli.org](http://www.everythingcli.org/)**Contrib:** PyPI: [cytopia](https://pypi.org/user/cytopia/) **ยท**
Terraform: [cytopia](https://registry.terraform.io/namespaces/cytopia) **ยท**
Ansible: [cytopia](https://galaxy.ansible.com/cytopia)## ๐ License
**[MIT License](LICENSE)**
Copyright (c) 2016 [cytopia](https://github.com/cytopia)