add redirect to nginx
This commit is contained in:
parent
8b295da3a3
commit
df477801d4
@ -42,6 +42,11 @@
|
||||
cmd: certbot certonly --non-interactive --agree-tos -m tormakristof@tormakristof.eu --nginx -d {{item.domain}}
|
||||
with_items: "{{ static }}"
|
||||
|
||||
- name: Generate certificate for all static sites
|
||||
command:
|
||||
cmd: certbot certonly --non-interactive --agree-tos -m tormakristof@tormakristof.eu --nginx -d {{item.domain}}
|
||||
with_items: "{{ redirect }}"
|
||||
|
||||
- name: "Generate certbot script"
|
||||
ansible.builtin.template:
|
||||
src: certbot.sh
|
||||
|
@ -6,3 +6,6 @@ certbot renew --nginx --cert-name {{ proxysite.domain }}
|
||||
{% for staticsite in static %}
|
||||
certbot renew --nginx --cert-name {{ staticsite.domain }}
|
||||
{% endfor %}
|
||||
{% for redirectsite in redirect %}
|
||||
certbot renew --nginx --cert-name {{ redirectsite.domain }}
|
||||
{% endfor %}
|
||||
|
@ -92,4 +92,16 @@ http {
|
||||
}
|
||||
|
||||
{% endfor %}
|
||||
|
||||
{% for redirectsite in redirect %}
|
||||
server {
|
||||
listen 443 ssl http2;
|
||||
listen [::]:443 ssl http2;
|
||||
server_name {{ redirectsite.domain }};
|
||||
ssl_certificate /etc/letsencrypt/live/{{ redirectsite.domain }}/fullchain.pem;
|
||||
ssl_certificate_key /etc/letsencrypt/live/{{ redirectsite.domain }}/privkey.pem;
|
||||
return 301 {{ redisrectsite.destination }};
|
||||
}
|
||||
|
||||
{% endfor %}
|
||||
}
|
||||
|
@ -10,8 +10,10 @@ proxy:
|
||||
- {domain: swagger.kmlabz.com, ip: swagger.stargate.internal}
|
||||
|
||||
static:
|
||||
- {domain: tormakristof.eu, directory: /var/www/tormakristof.eu, repo: "https://git.kmlabz.com/kmlabz/homepage.git"}
|
||||
- {domain: tormakris.dev, directory: /var/www/tormakristof.eu, repo: "https://git.kmlabz.com/kmlabz/homepage.git"}
|
||||
- {domain: torma.xyz, directory: /var/www/tormakristof.eu, repo: "https://git.kmlabz.com/kmlabz/homepage.git"}
|
||||
- {domain: kmlabz.com, directory: /var/www/kmlabz.com, repo: "https://git.kmlabz.com/kmlabz/homepage.git"}
|
||||
|
||||
redirect:
|
||||
- {domain: tormakristof.eu, destination: "https://www.tormakristof.eu"}
|
||||
- {domain: tormakris.dev, destination: "https://www.tormakristof.eu"}
|
||||
- {domain: torma.xyz, destination: "https://www.tormakristof.eu"}
|
||||
...
|
||||
|
Loading…
Reference in New Issue
Block a user