Skip to content

An Alpine-based Nginx container with S6-Overlay used for August Ash initiatives.

License

Notifications You must be signed in to change notification settings

augustash/docker-alpine-nginx

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Alpine Nginx Image

https://www.augustash.com

This base container is not currently aimed at public consumption. It exists as a starting point for August Ash containers.

Versions

See VERSIONS.md for image contents.

Usage

Launch a single-use Nginx container serving the current directory:

docker run --rm \
    -p 8080:80 \
    -p 8443:443 \
    -v $(pwd):/src \
    augustash/alpine-nginx

Accessing Served Content

Ports 80 and 443 are exposed via this image. To access the Nginx web server from outside the container, you'll need to map ports on your host to the container.

This container works best in combination with our PHP-FPM container so that dynamic content can be served.

Note: If your PHP-FPM container was started with docker-compose and has a network, you'll need to link it differently:

docker run --rm \
    -p 8080:80 \
    -p 8443:443 \
    --link <PHP CONTAINER>:phpfpm \
    --net <NETWORK NAME> \
    -v $(pwd)/site.template:/config/nginx/hosts.d/site.conf \
    -v $(pwd):/src \
    augustash/alpine-nginx

HTML Content

The content served by this container lives in the /src directory. You can customize what will be served by mounting a host directory to /src.

Nginx Configuration and Host Configuration

The image is prepared in a way to make it relatively easy to customize both Nginx itself and the hosts.

Custom Nginx configuration should be added to /etc/nginx/conf.d/ and custom host files should be added to /etc/nginx/hosts.d/.

The structure of the directory should look like:

/config/nginx
├── conf.d
│   ├── 10-mime.conf
│   ├── 20-logs.conf
│   ├── 30-gzip.conf
│   ├── 40-general.conf
│   └── 50-ssl.conf
├── hosts.d
│   └── default.conf
└── nginx.conf

User/Group Identifiers

To help avoid nasty permissions errors, the container allows you to specify your own PUID and PGID. This can be a user you've created or even root (not recommended).

Environment Variables

The following variables can be set and will change how the container behaves. You can use the -e flag, an environment file, or your Docker Compose file to set your preferred values. The default values are shown:

  • PUID=501
  • PGID=1000
  • NGINX_SSL_SUBJECT=/C=US/ST=MN/L=Minneapolis/O=August Ash/OU=Local Server/CN=*
  • NGINX_DH_SIZE=2048

Inspiration