Sign inSign up

arpanpal010/alpine-nginx

By arpanpal010

•Updated almost 9 years ago

Automated NGINX image built from alpine-s6 on a Raspberry Pi 3/Intel NUC.

Image
1

1.9K

arpanpal010/alpine-nginx repository overview

⁠Alpine-NGINX

⁠Container for NGINX Reverse Proxy / Web Server.

Image⁠ for NGINX⁠ web server running in a container. Default configuration sets up a static site at /config/www and listens on port 80 and ssl on port 443. Self signed SSL keys are generated if not available at /config/keys, and turned on by default. htpasswd is also generated with the credentials admin / insecurebydefault at /config/keys/.htpasswd if not available and turned on by default for the location /secure.

Built from my alpine-s6⁠ image. Based on Alpine Linux⁠

The image is tagged respectively for 2 architectures,

  • armhf
  • x86_64

The configuration files are in the volume /config. Mount this one locally to persist the files for modification. For NGINX the files are in /config/nginx. add your vhosts in /config/nginx/site-confs. An additional volume /storage can be mounted if needed for indexing.

If you are running multiple containers in a number of hosts like me, you will need to reverse proxy ports in other machines (easy) as well as ports that are running in containers in the same host. For the latter case the --net=host flag is needed, as well as an entry for allowing it in the firewall table of the host network.


⁠Get the Image

Pull the image for your architecture it's already available from Docker Hub.

# make pull
docker pull arpanpal010/alpine-nginx:x86_64


⁠Run

# make
# docker run --rm -it \
  --name docker_nginx --hostname nginx \
  -e PGID=100 -e PUID=1000 \
  -c 256 -m 64m \
  -e WEBADMIN=admin -e PASSWORD=setyourown \ #(optional)
  -p 80:80 -p 443:443 \
  -v config:/config
  -v storage:/storage:ro \ #(optional)
  -v /etc/hosts:/etc/hosts:ro \
  -v /etc/localtime:/etc/localtime:ro \
  -e TZ=Asia/Kolkata \
  --net=host \ #(optional)
  arpanpal010/alpine-nginx:x86_64

# make stop
docker stop -t 2 docker_nginx

# make rm
# stop first
docker rm -f docker_nginx

# make restart
docker restart docker_nginx


⁠Shell access

# make rshell
docker exec -u root -it docker_nginx /bin/bash

# make shell
docker exec -it docker_nginx /bin/bash

# make logs
docker logs -f docker_nginx


⁠Services

PS: this bit is for dev only as you need the files from the repo.

# make systemd
# add systemd.service as a service if it exists, load it, and start or restart
# it if already running.

# make logs
docker logs -f docker_nginx


⁠Development


If you have the repository access, you can clone and build the image yourself for your own system, and can push after.


⁠Setup

Before you clone the repo, you must have Git⁠, GNU make⁠, and Docker⁠ setup on the machine.

git clone <repository url>
cd <repository>

You can always skip installing make but you will have to type the whole docker commands then instead of using the sweet make targets.


⁠Build

To locally build the image for your system.

# make build
  docker build --rm --force-rm \
  -t arpanpal010/alpine-nginx:x86_64
  --no-cache=true --pull .

# make push
docker push arpanpal010/alpine-nginx:x86_64


⁠Maintenance


Currently built daily on a RaspberryPi3 (armhf builds) or IntelNUC (x64 builds). Docker hub builds maintained by arpanpal010⁠.

Tag summary

Content type

Image

Digest

Size

8.3 MB

Last updated

almost 9 years ago

docker pull arpanpal010/alpine-nginx:x86_64