diff --git a/templates/gitea.j2 b/templates/gitea.j2 index 33c446c..e11ed6a 100644 --- a/templates/gitea.j2 +++ b/templates/gitea.j2 @@ -2,54 +2,55 @@ {% if gitea_enable_https | default(false) %} server { - listen 443 ssl http2; - server_name {{ gitea_domain }}; + listen 443 ssl; + http2 on; + server_name {{ gitea_domain }}; - ssl_certificate {{ gitea_ssl_cert }}; - ssl_certificate_key {{ gitea_ssl_key }}; + ssl_certificate {{ gitea_ssl_cert }}; + ssl_certificate_key {{ gitea_ssl_key }}; - ssl_protocols TLSv1.2 TLSv1.3; - ssl_ciphers HIGH:!aNULL:!MD5; + ssl_protocols TLSv1.2 TLSv1.3; + ssl_ciphers HIGH:!aNULL:!MD5; - client_max_body_size 50M; + client_max_body_size 50M; - location / { - client_max_body_size 512M; - proxy_pass http://localhost:{{ gitea_http_port }}; - proxy_set_header Connection $http_connection; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; - } + location / { + client_max_body_size 512M; + proxy_pass http://localhost:{{ gitea_http_port }}; + proxy_set_header Connection $http_connection; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + } } {% if gitea_enable_http_redirect | default(true) %} server { - listen 80; - server_name {{ gitea_domain }}; - return 301 https://$host$request_uri; + listen 80; + server_name {{ gitea_domain }}; + return 301 https://$host$request_uri; } {% endif %} {% else %} # HTTP-only configuration server { - listen 80; - server_name {{ gitea_domain }}; + listen 80; + server_name {{ gitea_domain }}; - client_max_body_size 50M; + client_max_body_size 50M; - location / { - client_max_body_size 512M; - proxy_pass http://localhost:{{ gitea_http_port }}; - proxy_set_header Connection $http_connection; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; - } + location / { + client_max_body_size 512M; + proxy_pass http://localhost:{{ gitea_http_port }}; + proxy_set_header Connection $http_connection; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + } } {% endif %}