summaryrefslogtreecommitdiffstats
path: root/roles/cgit/templates/cgit.nginx.conf.j2
diff options
context:
space:
mode:
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 %}