summaryrefslogtreecommitdiffstats
path: root/roles/cgit/templates/cgit.nginx.conf.j2
diff options
context:
space:
mode:
authorAhmed Abdelhalim <[email protected]>2026-07-16 17:36:44 +0200
committerAhmed Abdelhalim <[email protected]>2026-07-16 17:36:44 +0200
commite8c668bc0bbf46bd2ca6e8c946ad297b157dd347 (patch)
tree7b7cf0b132b0d86ee671f44d2cb37a4d5eb1ade7 /roles/cgit/templates/cgit.nginx.conf.j2
parentb8a256f91c0d278e38f19943eca53951aa7c4946 (diff)
Allow cgit to theoretically deploy to public URL
Diffstat (limited to 'roles/cgit/templates/cgit.nginx.conf.j2')
-rw-r--r--roles/cgit/templates/cgit.nginx.conf.j216
1 files changed, 11 insertions, 5 deletions
diff --git a/roles/cgit/templates/cgit.nginx.conf.j2 b/roles/cgit/templates/cgit.nginx.conf.j2
index 62fa6669..4ac0ae43 100644
--- a/roles/cgit/templates/cgit.nginx.conf.j2
+++ b/roles/cgit/templates/cgit.nginx.conf.j2
@@ -1,22 +1,28 @@
server {
listen 80;
listen [::]:80;
-
server_name {{ cgit_hostname }};
+ location / {
+ proxy_pass http://{{ network_ipv4_address }}:{{ cgit_port }};
+ }
+}
+{% if cgit_public_hostname is defined %}
+server {
+ listen 80;
+ listen [::]:80;
+ server_name {{ cgit_public_hostname }};
return 301 https://$server_name$request_uri;
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
-
- server_name {{ cgit_hostname }};
-
+ server_name {{ cgit_public_hostname }};
ssl_certificate {{ nginx_ssl_certificate }};
ssl_certificate_key {{ nginx_ssl_certificate_key }};
-
location / {
proxy_pass http://{{ network_ipv4_address }}:{{ cgit_port }};
}
}
+{% endif %}