aboutsummaryrefslogtreecommitdiffstats
path: root/roles/web/templates/sites/liwt.git.conf.j2
diff options
context:
space:
mode:
authorAaron LI <aly@aaronly.me>2018-03-04 10:11:32 +0800
committerAaron LI <aly@aaronly.me>2018-03-14 11:35:08 +0800
commitb9ce06b9729574cd79f494dcd7c01dcc381ac708 (patch)
tree2527f106c97e2880185bf7347be1e6808d134086 /roles/web/templates/sites/liwt.git.conf.j2
parentf0872a922769fab1abd02e4a066a40cfc477980c (diff)
downloadansible-dfly-vps-b9ce06b9729574cd79f494dcd7c01dcc381ac708.tar.bz2
web: add nginx sites
Diffstat (limited to 'roles/web/templates/sites/liwt.git.conf.j2')
-rw-r--r--roles/web/templates/sites/liwt.git.conf.j247
1 files changed, 47 insertions, 0 deletions
diff --git a/roles/web/templates/sites/liwt.git.conf.j2 b/roles/web/templates/sites/liwt.git.conf.j2
new file mode 100644
index 0000000..363d493
--- /dev/null
+++ b/roles/web/templates/sites/liwt.git.conf.j2
@@ -0,0 +1,47 @@
+{% set domain = "liwt.net" %}
+#
+# nginx/sites: liwt.git.conf
+# Website: git.{{ domain }}
+# Share/publish projects (git repositories) using `cgit`.
+#
+# Refernce:
+# [1] ArchWiki - cgit
+# https://wiki.archlinux.org/index.php/Cgit
+#
+#
+# Aaron LI
+# 2017-06-18
+#
+
+{% if domains_hascert[domain] %}
+server {
+ listen 443 ssl http2;
+ listen [::]:443 ssl http2;
+ server_name git.{{ domain }};
+
+ # SSL/TLS Certificate kindly provided by Let's Encrypt
+ ssl_certificate /usr/local/etc/ssl/acme/{{ domain }}/fullchain.pem;
+ ssl_certificate_key /usr/local/etc/ssl/acme/private/{{ domain }}.pem;
+
+ # Projects (git repositories) location
+ root /usr/local/www/cgit;
+ try_files $uri @cgit;
+
+ location @cgit {
+ # Require `www/uwsgi` package and configurations in `/etc/rc.conf`.
+ include uwsgi_params;
+ # modifier1: 9 - size of CGI block vars (HTTP request body excluded)
+ uwsgi_modifier1 9;
+ uwsgi_pass unix:/var/run/uwsgi-cgit.sock;
+ }
+
+ location /static/ {
+ root /home/www/git/;
+ }
+
+ error_page 500 502 503 504 /50x.html;
+ location = /50x.html {
+ root /usr/local/www/nginx-dist;
+ }
+}
+{% endif %}