2019-11-25 00:50:21 +00:00
|
|
|
server {
|
|
|
|
listen 80;
|
|
|
|
{% if ansible_all_ipv6_addresses | length %}
|
|
|
|
listen [::]:80;
|
|
|
|
{% endif %}
|
|
|
|
server_name {{ gitea_domain }};
|
|
|
|
|
|
|
|
location /.well-known/acme-challenge/ {
|
2020-08-22 14:59:26 +00:00
|
|
|
root /var/www/html;
|
2019-11-25 00:50:21 +00:00
|
|
|
try_files $uri =404;
|
|
|
|
}
|
|
|
|
|
2019-12-01 19:44:49 +00:00
|
|
|
{% if gitea_ssl_enabled is defined and
|
|
|
|
gitea_ssl_enabled %}
|
2019-11-25 00:50:21 +00:00
|
|
|
location / {
|
|
|
|
return 301 https://$server_name$request_uri;
|
|
|
|
}
|
|
|
|
{% endif %}
|
|
|
|
}
|
|
|
|
|
2019-12-01 19:44:49 +00:00
|
|
|
{% if gitea_ssl_enabled is defined and
|
|
|
|
gitea_ssl_enabled %}
|
2019-11-25 00:50:21 +00:00
|
|
|
server {
|
|
|
|
listen 443 ssl;
|
|
|
|
{% if ansible_all_ipv6_addresses | length %}
|
|
|
|
listen [::]:443 ssl;
|
|
|
|
{% endif %}
|
|
|
|
server_name {{ gitea_domain }};
|
|
|
|
|
|
|
|
{% if gitea_ssl_certificate is defined %}
|
|
|
|
ssl_certificate {{ gitea_ssl_certificate }};
|
|
|
|
{% endif %}
|
|
|
|
{% if gitea_ssl_certificate_key is defined %}
|
|
|
|
ssl_certificate_key {{ gitea_ssl_certificate_key }};
|
|
|
|
{% endif %}
|
|
|
|
{% if gitea_ssl_dhparam is defined %}
|
|
|
|
ssl_dhparam {{ gitea_ssl_dhparam }};
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
location / {
|
2019-12-01 19:44:49 +00:00
|
|
|
{% if gitea_config.server.protocol is defined and
|
|
|
|
gitea_config.server.protocol == 'unix' %}
|
|
|
|
proxy_pass http://unix:{{ gitea_config.server.http_addr }};
|
|
|
|
{% else %}
|
2019-11-25 00:50:21 +00:00
|
|
|
proxy_pass http://localhost:{{ gitea_port }};
|
2019-12-01 19:44:49 +00:00
|
|
|
{% endif %}
|
2019-11-25 00:50:21 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
{% endif %}
|