hispanico.nginx_revproxy

ansible-role-nginx_revproxy

=========

This Ansible role installs and configures Nginx to act as a reverse proxy for multiple websites.

GitHub Quality Downloads Galaxy Version
CI quality downloads Galaxy Version

Requirements


You need Ansible version 2.4 or higher to use this role.

Role Variables


Here are the default settings you can use:

nginx_revproxy_sites:                                         # List of websites to reverse proxy
  default:                                                    # Default website settings
    ssl: false                                                # Set to True to redirect HTTP to HTTPS
    letsencrypt: false

  example.com:                                                # Domain name
    domains:                                                  # List of domain name aliases
      - example.com
      - www.example.com
    upstreams:                                                # List of upstream servers
      - { backend_address: 192.168.0.100, backend_port: 80 }
      - { backend_address: 192.168.0.101, backend_port: 8080 }
    auth:                                                     # Optional: define a username/password for HTTP access, or leave out for no authentication
      login: myusername
      password: mysecretpassword
    extra_locations:                                           # Optional: define extra locations or leave empty
      websocket:                                              # Name of the extra location
        upstreams:                                            # List of upstreams for the extra location
          - { backend_address: 192.168.0.102, backend_port: 8088 }
    listen: 9000                                              # Port for clear HTTP, leave empty for default port 80
    ssl: false                                                # Set to True to redirect HTTP to HTTPS
    letsencrypt: false                                        # Set to True to use Let's Encrypt
    conn_upgrade: true                                        # Set Connection upgrade header values
    acls:                                                     # Limit access to specific client addresses (options: address, CIDR, unix, or all)
      - { mode: allow, value: 192.168.0.1 }
      - { mode: deny, value: all }

  example.org:                                                # Additional domain name settings
    domains:                                                  # List of domain name aliases
      - example.org
      - www.example.org
    upstreams:                                                # List of upstream servers
      - { backend_address: 192.168.0.200, backend_port: 80 }
      - { backend_address: 192.168.0.201, backend_port: 8080 }
    listen: 9000                                              # Port for clear HTTP, leave empty for default port 80
    listen_ssl: 9001                                          # Port for HTTPS, leave empty for default port 443
    ssl: true                                                 # Set to True to redirect HTTP to HTTPS
    ssl_certificate: /etc/ssl/certs/ssl-cert-snakeoil.pem     # SSL certificate, used if not using Let's Encrypt
    ssl_certificate_key: /etc/ssl/private/ssl-cert-snakeoil.key # SSL certificate key, used if not using Let's Encrypt
    letsencrypt: false                                        # Set to True to use Let's Encrypt
    letsencrypt_email: ""                                     # Email for Let's Encrypt certificate

nginx_revproxy_certbot_auto: false                             # Set to true for automatic certbot installation

nginx_revproxy_certbot_packages:                              # Packages to install from the repository, if not using certbot-auto
  - certbot
  - python3-certbot-nginx

Dependencies


There are no dependencies for this role.

Example Playbook


Here is an example of how to use this role in a playbook:

  - hosts: all
    roles:
      - hispanico.nginx_revproxy
    vars:
      nginx_revproxy_sites:
        default:
          ssl: false
          letsencrypt: false

        example.com:
          domains:
            - example.com
            - www.example.com
          upstreams:
            - { backend_address: 192.168.0.100, backend_port: 80 }
            - { backend_address: 192.168.0.101, backend_port: 80 }
          ssl: true
          letsencrypt: false

License


This role is licensed under the GPLv3 License. Please refer to the LICENSE file for more information.

Author Information


Created by Hispanico.

Informazioni sul progetto

Manage Nginx as Reverse Proxy

Installa
ansible-galaxy install hispanico.nginx_revproxy
Licenza
gpl-3.0
Download
69.4k
Proprietario
@openwisp Contributor and @ninuxorg Member