summaryrefslogtreecommitdiffstats
path: root/roles/cgit/templates
diff options
context:
space:
mode:
Diffstat (limited to 'roles/cgit/templates')
-rw-r--r--roles/cgit/templates/cgit.caddy.j23
-rw-r--r--roles/cgit/templates/cgit.lighttpd.conf.j224
-rw-r--r--roles/cgit/templates/cgit.nginx.conf.j225
-rw-r--r--roles/cgit/templates/cgitrc.j24
4 files changed, 43 insertions, 13 deletions
diff --git a/roles/cgit/templates/cgit.caddy.j2 b/roles/cgit/templates/cgit.caddy.j2
new file mode 100644
index 00000000..8ddc6d88
--- /dev/null
+++ b/roles/cgit/templates/cgit.caddy.j2
@@ -0,0 +1,3 @@
+{{ cgit_hostname }} {
+ reverse_proxy {{ network_ipv4_address }}:{{ cgit_port }}
+}
diff --git a/roles/cgit/templates/cgit.lighttpd.conf.j2 b/roles/cgit/templates/cgit.lighttpd.conf.j2
new file mode 100644
index 00000000..0fd1d535
--- /dev/null
+++ b/roles/cgit/templates/cgit.lighttpd.conf.j2
@@ -0,0 +1,24 @@
+server.port = {{ cgit_port }}
+server.bind = "{{ network_ipv4_address }}"
+server.modules = ("mod_cgi", "mod_rewrite")
+
+server.document-root = "/usr/share/webapps/cgit"
+server.pid-file = "/run/lighttpd.pid"
+
+mimetype.assign = (
+ ".css" => "text/css",
+ ".png" => "image/png",
+ ".ico" => "image/x-icon",
+ ".txt" => "text/plain",
+ ".html" => "text/html",
+)
+
+cgi.assign = (".cgi" => "")
+
+url.rewrite-once = (
+ "^/cgit\.css$" => "/cgit.css",
+ "^/cgit\.png$" => "/cgit.png",
+ "^/favicon\.ico$" => "/favicon.ico",
+ "^/robots\.txt$" => "/robots.txt",
+ "^(/.*)?$" => "/cgit.cgi$1",
+)
diff --git a/roles/cgit/templates/cgit.nginx.conf.j2 b/roles/cgit/templates/cgit.nginx.conf.j2
index 14256054..62fa6669 100644
--- a/roles/cgit/templates/cgit.nginx.conf.j2
+++ b/roles/cgit/templates/cgit.nginx.conf.j2
@@ -1,19 +1,22 @@
server {
- listen {{ cgit_port }};
- listen [::]:{{ cgit_port }};
+ listen 80;
+ listen [::]:80;
server_name {{ cgit_hostname }};
- root /usr/share/webapps/cgit;
+ return 301 https://$server_name$request_uri;
+}
+
+server {
+ listen 443 ssl http2;
+ listen [::]:443 ssl http2;
+
+ server_name {{ cgit_hostname }};
- try_files $uri @cgit;
+ ssl_certificate {{ nginx_ssl_certificate }};
+ ssl_certificate_key {{ nginx_ssl_certificate_key }};
- location @cgit {
- fastcgi_pass unix:/run/fcgiwrap/fcgiwrap.sock;
- fastcgi_param SCRIPT_FILENAME /usr/lib/cgit/cgit.cgi;
- fastcgi_param PATH_INFO $uri;
- fastcgi_param QUERY_STRING $args;
- fastcgi_param HTTP_HOST $server_name;
- include fastcgi_params;
+ location / {
+ proxy_pass http://{{ network_ipv4_address }}:{{ cgit_port }};
}
}
diff --git a/roles/cgit/templates/cgitrc.j2 b/roles/cgit/templates/cgitrc.j2
index a23e2d0b..89578a7c 100644
--- a/roles/cgit/templates/cgitrc.j2
+++ b/roles/cgit/templates/cgitrc.j2
@@ -1,5 +1,5 @@
-css=/cgit/cgit.css
-logo=/cgit/cgit.png
+css=/cgit.css
+logo=/cgit.png
virtual-root=/