nginx_site: Fix certbot virtual host

This commit is contained in:
Timo Makinen 2024-06-28 15:22:17 +00:00
parent ed5bc5028b
commit 8ad160b046

View file

@ -47,7 +47,9 @@ server {
listen 80; listen 80;
listen [::]:80; listen [::]:80;
server_name {{ nginx_site_name }}; server_name {{ nginx_site_name }};
{% if nginx_site_name != 'certbot.home.foo.sh' %} {% if nginx_site_name == 'certbot.home.foo.sh' and 'proxy' not in groups %}
root /srv/web/{{ nginx_site_name }};
{% else %}
location /.well-known/acme-challenge/ { location /.well-known/acme-challenge/ {
proxy_pass http://certbot.home.foo.sh/.well-known/acme-challenge/; proxy_pass http://certbot.home.foo.sh/.well-known/acme-challenge/;
} }
@ -58,8 +60,6 @@ server {
return 301 https://$host$request_uri; return 301 https://$host$request_uri;
{% endif %} {% endif %}
} }
{% else %}
root /srv/web/{{ nginx_site_name }};
{% endif %} {% endif %}
} }
{% endif %} {% endif %}