summaryrefslogtreecommitdiff
path: root/playbooks.d/webserver/share/sites.d/nl.tyil.home
blob: 55326a3125525ae44a16b3bebf8fa524d717ea2e (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
54
55
56
57
58
59
60
61
62
63
64
server {
	listen 443 ssl; # managed by Certbot
	listen [::]:443 ssl; # managed by Certbot

	server_name home.tyil.nl;

	ssl_certificate /etc/letsencrypt/live/home.tyil.nl/fullchain.pem;
	ssl_certificate_key /etc/letsencrypt/live/home.tyil.nl/privkey.pem;

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

	location / {
		return 301 https://www.tyil.nl$request_uri;
	}

	location ~ ^/~(.+?)(/.*)?$ {
		alias /home/$1/www$2;
		autoindex on;
	}

	location /git {
		rewrite ^/git/(.*)$ https://git.tyil.nl/$1 redirect;
	}

	location /media {
		alias /var/media;

		satisfy any;

		allow 127.0.0.1;
		allow 10.57.0.0/16;
		allow 192.168.178.0/24;
		deny all;

		auth_basic "pls no hack";
		auth_basic_user_file "/var/media/.htpasswd";

		autoindex on;
	}

	location /media/backups { deny all; }
	location /media/nextcloud { deny all; }
	location /media/pictures { deny all; }
	location /media/recordings { deny all; }

	location /packages {
		alias /var/portage/packages;
		autoindex on;
	}
}

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

	server_name home.tyil.nl;

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

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