acez.nginx

nginx

角色用于设置一个支持自签名 SSL 证书和 Let's Encrypt 通配符证书(使用 DNS 验证)的 nginx 容器。

限制

目前,DNS 验证仅支持 netcup DNS,并且只能配置一个域名,配置在 nginx_config_netcup_domain 中。

要求

目标机器上需要安装 Docker 及其所有管理 Docker 容器的依赖项,以便此角色正常工作。

角色变量

配置键 描述 默认值
nginx_container_name 启动的 nginx 容器的名称。 nginx
nginx_container_networks 启动容器的 Docker 网络列表。
nginx_image_name nginx 镜像名称的覆盖。如果想提供自己的镜像,请使用此项。 nginx
nginx_image_tag 使用的 nginx 镜像的标签。 stable
nginx_config_expose_ports Docker 格式的暴露端口列表。(例如 - "80:80") - "80:80"
- "443:443"
nginx_filesystem_root nginx 文件的文件系统路径。
nginx_filesystem_sites 存储站点配置的文件系统路径。
nginx_filesystem_ssl 存储 SSL 证书的文件系统路径。
nginx_config_cert_email SSL 证书的电子邮箱。
nginx_config_letsencrypt_dns_challenge_provider Let's Encrypt DNS 验证的提供商。当前仅支持 netcup。 netcup
nginx_config_letsencrypt_account_email Let's Encrypt 的账户电子邮箱。
nginx_config_letsencrypt_acme_directory Let's Encrypt ACME 目录。可以是测试环境或生产环境。 https://acme-v02.api.letsencrypt.org/directory
nginx_config_sites nginx 网站列表
nginx_config_netcup_api_key Netcup API 密钥
nginx_config_netcup_api_password Netcup API 密码
nginx_config_netcup_customer_id Netcup 客户 ID
nginx_config_netcup_domain Netcup 域名

nginx_config_sites 的变量

变量名 描述 默认值
hostname 网站的主机名,也将作为文件名。
ssl_provider 指定 SSL 证书提供商。 self-signed, letsencrypt
path_config 路径配置列表。

路径配置的变量

变量名 描述
location 要配置的 HTTP 网站位置。
proxy_pass proxy_pass 的路径。
configuration 路径的附加 nginx 配置。这些配置将逐一放置到 nginx 的路径配置中。

nginx_config_sites 示例

nginx_config_sites:
  - hostname: my.domain.com
    ssl_provider: letsencrypt
    path_config:
      - location: "/"
        proxy_pass: "http://internal-host:8080"
      - location: "/my-grafana-installation"
        proxy_pass: "http://internal-host-2:3000"
        configuration:
          - "rewrite /grafana/(.*) /$1  break;"

依赖

许可证

MIT

关于项目

Ansible role to setup a nginx container

安装
ansible-galaxy install acez.nginx
许可证
mit
下载
190
拥有者
Developer based in Ulm, Germany