summaryrefslogtreecommitdiff
path: root/playbooks.d/webserver/share/sites.d/nl.tyil.dnd-wiki
blob: 40108c12138c0b571adae7faacf405fd9d4e841f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
server {
	listen 443 ssl; # managed by Certbot
	listen [::]:443 ssl; # managed by Certbot
	server_name dnd-wiki.tyil.nl;

	ssl_certificate /etc/letsencrypt/live/dnd-wiki.tyil.nl/fullchain.pem;
	ssl_certificate_key /etc/letsencrypt/live/dnd-wiki.tyil.nl/privkey.pem;

	include /etc/nginx/conf.d/ssl.conf;
	include /etc/nginx/conf.d/certbot.conf;

	root /var/www/nl.tyil.dnd-wiki;

	client_max_body_size 10M;

	location / {
		index doku.php;
		try_files $uri $uri/ @dokuwiki;
	}

	location ~ ^/lib.*\.(gif|png|ico|jpg)$ {
		expires 30d;
	}

	location ^~ /conf/ { return 403; }
	location ^~ /data/ { return 403; }

	location @dokuwiki {
		rewrite ^/_media/(.*) /lib/exe/fetch.php?media=$1 last;
		rewrite ^/_detail/(.*) /lib/exe/detail.php?media=$1 last;
		rewrite ^/_export/([^/]+)/(.*) /doku.php?do=export_$1&id=$2 last;
		rewrite ^/(.*) /doku.php?id=$1 last;
	}

	location ~ \.php$ {
		include fastcgi_params;
		fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
		fastcgi_pass localhost:9000;
	}
}

server {
	listen 80;
	listen [::]:80;

	server_name dnd-wiki.tyil.nl;

	include /etc/nginx/conf.d/certbot.conf;

	location / {
		return 301 https://$host$request_uri;
	}
}