Nginx webserver with Certbot (Let's Encrypt)
373
Webserver using the Nginx application. With the possibility to configure Let's Encrypt SSL certificates using the Certbot application.
It is possible to configure the services through the Nginx *.conf files.
It is possible to use template *.conf.template files to generate the final .conf files with the appropriate substitutions of the values of the environment variables.
If you want, configure a website or reverse proxy of your services using only environment variables.
Configuring your services or websites:
HOST1_URL = domain1.com domain1-secondary.com domain1-other.com
HOST1_LOCATION = 10.0.0.10:5555 or website-directory/php7
/php5 or /php7.a-z, 0-9, -, . to set sub-sites.HOST1_LOCATION with main website with PHP5 and subsite1 with default PHP version and subsite2 with PHP7: /php5,subsite1,subsite2/php7.HOST1_AUTH = username1=password1,username2=password2,username3=password3
HOST1_SSL_EMAIL = [email protected]
HOST1_NGINX_CONFIG = try_files $uri $uri/ /index.php?$args;
Configuring more than one:
As you should see the names of the environment variables above are prefixed with HOST1. To register other services sequentially use HOST2, HOST3 and so on.
If your sequence happens to skip a number, everything else will be ignored.
For example, if you register HOST1, HOST2, HOST4, HOST5, HOST6, only the first two will be considered.
If the first on the list is HOST0 it will not be considered.
If the first on the list is HOST2, nothing else will be considered.
/etc/nginx.templates
*.template in this directory to make the files in the /etc/nginx/conf.d directory with replacement of environment variables with their values..template file is empty or all commented it will be ignored.server-common.conf.part.template will be inserted into each Nginx server section of any website.server-*.conf.part.template will be inserted into each Nginx server section.location-common.conf.part.template will be inserted into each Nginx location section of any website.location-*.conf.part.template will be inserted into each Nginx location section.site-*.conf.template will be used instead on the fly generated configuration file./etc/nginx.conf
/etc/nginx/ directory is a symbolic link that points to this directory./etc/nginx.certificates
/home
/var/log/nginx
/var/log/letsencrypt
/var/lib/nginx/tmp
Automatic reverse proxy or website settings using environment variables register as HTTP and HTTPS ports 80 and 443 respectively.
version: "3.3"
services:
proxy:
image: sergiocabral/nginx
ports:
- 80:80
- 443:443
volumes:
- /docker-volumes/nginx/templates:/etc/nginx.templates
- /docker-volumes/nginx/certificates:/etc/nginx.certificates
- /docker-volumes/nginx/conf:/etc/nginx.conf
- /docker-volumes/nginx/log:/var/log/nginx
- /docker-volumes/nginx/temp:/var/lib/nginx/tmp/
environment:
# Reverse proxy. Multiple urls. With HTTP authentication. With SSL certificate.
- HOST1_URL=domain1.com domain1-secondary.com domain1-other.com
- HOST1_LOCATION=10.0.0.11:5555
- HOST1_AUTH=username1=password1,username2=password2,username3=password3
- HOST1_SSL_EMAIL = [email protected]
# Website. Single url. Without HTTP authentication. Without SSL certificate.
- HOST2_URL=domain2.com
- HOST2_LOCATION=my-website
# Website. Without HTTP authentication. With SSL certificate.
- HOST3_URL=domain3.com
- HOST3_LOCATION=my-other-website
- HOST3_SSL_EMAIL = [email protected]
# Reverse proxy. Single url. With HTTP authentication. Without SSL certificate.
- HOST4_URL=domain4.com
- HOST4_LOCATION=10.0.0.14:2222
- HOST4_AUTH=username1=password1
Content type
Image
Digest
Size
25.8 MB
Last updated
almost 5 years ago
docker pull sergiocabral/nginx