blob: 9a90151e8c01624cf2e12a638690daaa73c9c7c5 (
plain) (
blame)
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
|
{ pkgs, ... }: {
environment.systemPackages = with pkgs; [
apacheHttpd
];
networking.firewall = {
allowedTCPPorts = [ 80 443 ];
allowedUDPPorts = [ 80 443 ];
};
services.httpd = {
enable = true;
extraModules = [ "ssl" ];
virtualHosts = {
"00000_http.com" = {
listen = [ { port = 80; } ];
documentRoot = "/var/www/default";
};
"00000_https.com" = {
onlySSL = true;
extraConfig = ''
RewriteEngine On
RewriteRule ^ http://%{HTTP_HOST}%{REQUEST_URI} [R=302,L,QSA]
'';
# Thanks https://discourse.nixos.org/t/where-can-i-get-snakeoil-certificates/14628/4
sslServerCert = "${pkgs.path}/nixos/tests/common/acme/server/acme.test.cert.pem";
sslServerKey = "${pkgs.path}/nixos/tests/common/acme/server/acme.test.key.pem";
};
};
extraConfig = ''
AddDefaultCharset utf-8
'';
};
}
|