blob: 5f1ae5389f7e4ce81b202e5f7506c0d2efc4d46a (
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
|
{ config, lib, pkgs, ... }:
let mpd_loc = (import ../data/aliases.nix).services.mpd;
mpdweb_loc = (import ../data/aliases.nix).services.mpdweb;
pjournal_loc = (import ../data/aliases.nix).services.pjournal;
in
{
imports = [ ./orbekk-pkgs.nix ];
security.acme.acceptTerms = true;
security.acme.email = "kj@orbekk.com";
networking.firewall.allowedTCPPorts = [ 80 443 ];
services.nginx = {
enable = true;
package = pkgs.nginxStable.override {
modules = with pkgs.nginxModules; [ dav ];
};
recommendedProxySettings = true;
appendHttpConfig = ''
# This is a workaround to deal with closed connections on
# large downloads.
proxy_buffering off;
charset utf-8;
'';
virtualHosts = let template = {
enableACME = true;
forceSSL = true;
};
in {
"orbekk.no" = template // {
root = "/storage/srv/orbekk.com";
};
"orbekk.com" = template // {
root = "/storage/srv/orbekk.com";
};
"kj.orbekk.com" = template // {
root = "/home/orbekk/www-public";
locations."/" = {
extraConfig = ''
try_files $uri @storage;
# kill cache
add_header Last-Modified $date_gmt;
add_header Cache-Control 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0';
if_modified_since off;
expires off;
etag off;
'';
};
locations."@storage" = {
root = "/storage/srv/kj.orbekk.com";
extraConfig = ''
autoindex on;
'';
};
locations."/stats/" = {
alias = "/var/lib/stats/out/";
extraConfig = "autoindex on;";
};
locations."/munin/" = {
alias = "/var/www/munin/";
extraConfig = "autoindex on;";
};
locations."/mpd" = {
proxyPass = "http://${mpd_loc.address}:${toString mpd_loc.port}/";
};
locations."/dav" = {
root = "/storage/srv/kj.orbekk.com";
extraConfig = ''
auth_basic webdav;
# htpasswd -c /opt/secret/nginx-webdav.htpasswd
dav_ext_methods PROPFIND OPTIONS;
auth_basic_user_file "/opt/secret/nginx-webdav.htpasswd";
dav_methods put delete mkcol copy move;
dav_access user:rw group:rw all:rw;
create_full_put_path on;
autoindex on;
'';
};
#locations."/systemd" = {
# proxyPass = "http://10.0.20.15:11105/";
#};
#locations."/hledger" = {
# extraConfig = ''return 302 /hledger/;'';
#};
# locations."/hledger/" = {
# proxyPass = "http://localhost:5000/";
# extraConfig = ''
# auth_basic "hledger";
# auth_basic_user_file /opt/site/hledger-htpasswd;
# '';
# };
locations."/_matrix" = {
proxyPass = "http://10.0.20.15:11102";
};
};
"ympd.orbekk.com" = template // {
locations."/" = {
proxyPass = "http://${mpdweb_loc.address}:${toString mpdweb_loc.port}/";
};
};
"git.orbekk.com" = template // {
locations."/".proxyPass = "http://10.0.20.2:11103";
};
"hydra.orbekk.com" = template // {
locations."/" = {
proxyPass = "http://10.0.20.2:11101";
};
};
"kufieta.net" = template // {
locations."/".proxyPass = "http://10.0.20.13:8080";
};
"journal.orbekk.com" = template // {
locations."/".proxyPass = "http://localhost:${toString pjournal_loc.port}";
};
};
};
}
|