hispanico.letsencrypt-nginx-revproxy
ansible-letsencrypt-nginx-revproxy
将Nginx配置为多个网站的反向代理,并使用Let's Encrypt证书。
要求
此角色需要Ansible 1.9或更高版本。
角色变量
默认值:
nginx_revproxy_sites: # 反向代理站点列表
example.com: # 域名
domains: # server_name别名列表
- example.com
- www.example.com
upstreams: # 上游列表
- { backend_address: 192.168.0.100, backend_port: 80 }
- { backend_address: 192.168.0.101, backend_port: 8080 }
letsencrypt: true # 如果使用hispanico.letsencrypt-nginx-revproxy角色,请设置为True
letsencrypt_email: '[email protected]'
依赖关系
示例剧本
此示例将nginx配置为以下站点的反向代理:
- example.org 使用自签名SSL证书
- example.com SSL证书通过Let's Encrypt ACME协议生成。
- hosts: all
roles:
- ansible-nginx-revproxy
- ansible-letsencrypt-nginx-revproxy
vars:
nginx_revproxy_sites:
example.org:
domains:
- example.org
- www.example.org
upstreams:
- { backend_address: 192.168.0.200, backend_port: 80 }
- { backend_address: 192.168.0.201, backend_port: 80 }
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 }
letsencrypt: true
许可证
根据GPLv3许可证许可。有关详细信息,请参见LICENSE文件。
作者信息
Hispanico