Sign inSign up

gjchen/nginx

By gjchen

•Updated almost 7 years ago

Alpine Linux with nginx configured for public web services.

Image
0

9.1K

gjchen/nginx repository overview

⁠gjchen/nginx@Dockerhub

Alpine Linux with nginx configured for public web services.

⁠Running Nginx Service in Docker Swarm Mode

Use virtual.host.com.conf (https://github.com/gjchentw/dockerfile-nginx/blob/master/virtual.host.com.conf⁠), with default/self-signed certs:

docker service create --name nginx --replicas 1 -p 80:80 -p 443:443 --mount type=bind,source=$(pwd)/certs/virtual.host.com,target=/etc/ssl/certs/virtual.host.com --mount type=bind,source=$(pwd)/virtual.host.com.conf,target=/etc/nginx/conf.d/virtual.host.com.conf gjchen/nginx

⁠Let's Encrypt

Put your domain in /etc/ssl/domains.txt:

echo virtual.host.com >> /etc/ssl/domains.txt

Get certificates manually:

/etc/ssl/dehydrated -c --ocsp

Auto renew weekly by /etc/crontabs/root (inspired by gslin https://letsencrypt.tw/⁠ ) :

0 0 * * * sleep $(expr $(printf "\%d" "0x$(hostname | md5sum | cut -c 1-8)") \% 86400);/etc/ssl/dehydrated -c --ocsp; nginx -s reload
  • PS. If have multiple replicas of gjchen/nginx, provide shared mounts /etc/ssl/.acme-challenges for challenges.

Tag summary

Content type

Image

Digest

Size

6.5 MB

Last updated

almost 7 years ago

docker pull gjchen/nginx