nginx_docker
Nginx reverse proxy Helper
NGINX reverse proxy server
Role is tested on, Ubuntu with Docker installed via my role bsmeding.docker on Linux distribution.
Used to be the frontend when deploying Docker containers on platforms Default image is from Linuxserver: https://docs.linuxserver.io/images/docker-nginx
At this moment, a limited set of config options are available. They will be added later.
Reverse proxy config
For every container (or other service/server) you can add a proxy config with the variable list nginx__proxy_confs_subdomain
. If you forward to containers, connect the to the same docker network for easy name resolution and security.
This example will forward incoming requests for dash.example.com
on port 80 to the container named dashboard
on port 9090, port 80 (http)
nginx__proxy_confs_subdomain:
- server_name: dash.example.com
listen: 80
enable_ldap: false
enable_authelia: false
default_upstream_proto: http
default_upstream_url: dashboard
default_upstream_port: 9090
Site files
If you wnat to copy a website directory, place them in /files/nginx/sites/<site_directory>
or /files/nginx/<inventory_hostname/sites/<site_directory>
when you deploy multiple servers with different sites
Site-conf files
If you want specific site-config files to be copied, place them in you're playbook dir /files/nginx/site-confs/
they must be in nginx site config file <site.conf>
Or in /files/nginx/<inventory_hostname/site-confs/
to seperate hosts configs
https / ssl / Certificate
Is you need certificates, plase them in your playbook directory under files/nginx/certs/
name them as website_url.crt
and website_url.key
When the key file is secured by a passphrase, ad this to you're subdomain variable, so it can be secured by ansible-vault
nginx__proxy_confs_subdomain:
- server_name: dash.example.com
listen: 80
listen_https: 443 # need to enable https
cert_key_passphrase: 'sbsta261da' # exampe off passhrase of cert.key file if set. Otherwise don't set this variable
enable_ldap: false
enable_authelia: false
default_upstream_proto: http
default_upstream_url: dashboard
default_upstream_port: 9090
Manage and run the Nginx container from Linuxserver(default).
ansible-galaxy install bsmeding/ansible_role_nginx_docker