feat: configure OpenResty vhosts for multiple domains
This commit is contained in:
parent
801083e761
commit
a701895121
@ -1,15 +1,33 @@
|
||||
- hosts: all
|
||||
---
|
||||
- name: setup OpenResty server
|
||||
hosts: icp-aliyun
|
||||
become: true
|
||||
vars:
|
||||
# Use the inventory hostname for delegation so Ansible
|
||||
# applies the correct connection variables
|
||||
ops_host: "k8s-1"
|
||||
masters:
|
||||
- "k8s-1"
|
||||
nodes:
|
||||
- "k8s-2"
|
||||
- "k8s-3"
|
||||
domain:
|
||||
- name: cn-homepage.svc.plus
|
||||
ssl_certificate: /etc/ssl/svc.plus.pem
|
||||
ssl_certificate_key: /etc/ssl/svc.plus.rsa.key
|
||||
- name: cn-artifact.svc.plus
|
||||
ssl_certificate: /etc/ssl/svc.plus.pem
|
||||
ssl_certificate_key: /etc/ssl/svc.plus.rsa.key
|
||||
roles:
|
||||
- roles/vhosts/common/
|
||||
- roles/vhosts/ssh-trust/
|
||||
- roles/vhosts/OpenResty/
|
||||
---
|
||||
- name: setup OpenResty server
|
||||
hosts: global-hub
|
||||
become: true
|
||||
vars:
|
||||
domain:
|
||||
- name: global-homepage.svc.plus
|
||||
ssl_certificate: /etc/ssl/svc.plus.pem
|
||||
ssl_certificate_key: /etc/ssl/svc.plus.rsa.key
|
||||
- name: global-artifact.svc.plus
|
||||
ssl_certificate: /etc/ssl/svc.plus.pem
|
||||
ssl_certificate_key: /etc/ssl/svc.plus.rsa.key
|
||||
roles:
|
||||
- roles/vhosts/common/
|
||||
- roles/vhosts/ssh-trust/
|
||||
- roles/vhosts/OpenResty/
|
||||
|
||||
|
||||
@ -39,7 +39,7 @@
|
||||
|
||||
- name: Verify OpenResty core API
|
||||
shell: |
|
||||
curl -fsS -X POST http://127.0.0.1:8080/api/askai \
|
||||
curl -fsS -X POST http://127.0.0.1/api/askai \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"question":"你好"}'
|
||||
register: openresty_verify
|
||||
|
||||
@ -4,9 +4,13 @@ events { worker_connections 1024; }
|
||||
http {
|
||||
lua_shared_dict limit_cache 10m;
|
||||
|
||||
{% for site in domain %}
|
||||
server {
|
||||
listen 80;
|
||||
server_name localhost;
|
||||
listen 443 ssl;
|
||||
server_name {{ site.name }};
|
||||
ssl_certificate {{ site.ssl_certificate }};
|
||||
ssl_certificate_key {{ site.ssl_certificate_key }};
|
||||
|
||||
location /api/askai {
|
||||
access_by_lua_block {
|
||||
@ -53,4 +57,6 @@ http {
|
||||
proxy_pass http://127.0.0.1:5000;
|
||||
}
|
||||
}
|
||||
{% endfor %}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user