Install Nginx Docker Compose project.
Based on LinuxServer.io image: https://docs.linuxserver.io/images/docker-nginx/
Includes Nginx ultimate bad bot blocker: https://github.com/mitchellkrogza/nginx-ultimate-bad-bot-blocker
Requires the following to be installed:
- docker
- docker compose
Common system variables:
timezone: UTCCommon Docker projects variables:
# Base directory for Docker projects
docker_projects_path: # /var/appsAvailable role variables are listed below, along with default values (see defaults/main.yml):
# Docker project variables
nginx_project_name: nginx
# Docker project dynamic vars (uses `docker_project_name` prefix, adapt if overridden)
# Traefik router entrypoints
nginx_traefik_entrypoints: 'http,https'
# Traefik router middlewares
nginx_traefik_middlewares:
- "https-redirect@file"
# Additional external docker-compose networks, joined by main service
nginx_additional_networks: []
# - postgres_default
# Main service additional docker-compose options (ex: cpu_shares, deploy, ...)
nginx_service_additional_options: |
#ports:
# - 80:80
# - 443:443
# Nginx project variables
# linuxserver/nginx image version
nginx_linuxserver_nginx_version: latest
nginx_app_volumes: []
# - /home/user/myapp # (will be mounted in /app/myapp)
# - src: /home/user/myotherapp
# dest: /app/mythirdappOptional target user variables:
target_user:
target_group:
target_user_uid:
target_user_gid:(when user/group information differ from Ansible user, become should be used in playbook)
Additional files in the following location will be copied in the project's config/ directory:
config/nginx/{{ inventory_hostname }}/*
or if target_user is defined:
config/nginx/{{ inventory_hostname }}-{{ target_user }}/*
See linuxserver/nginx documentation for details about the base image.
Example file structure:
config/nginx/-
some-hostname/nginx/site-confs/myapp-vhost.confotherapp-vhost.conf
nginx.conf
php/www2.conf
www/index.html
-
other-hostname-alice/nginx/site-confs/alice-vhost.conf
nginx.conf
-
other-hostname-bob/nginx/site-confs/bob-vhost.conf
nginx.conf
-
This role depends on :
Some variables allow integration with:
- hosts: all
gather_facts: true
gather_subset:
- "!all"
- "!min"
- user_id
roles:
- djuuu.nginx_dockerBeerware License