summaryrefslogtreecommitdiffstats
path: root/makefu/2configs/nginx
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2016-12-24 23:38:01 +0100
committermakefu <github@syntax-fehler.de>2016-12-24 23:38:01 +0100
commit1745abde62a68800e065aca8c0d8452ebd005da6 (patch)
tree30c6a557e55bb6a78588ee73f68d8db59d9d217e /makefu/2configs/nginx
parent78c50fe49599b5c3dd147ebd23253fa2abe53998 (diff)
m 2 *: krebs.nginx -> services.nginx
Diffstat (limited to 'makefu/2configs/nginx')
-rw-r--r--makefu/2configs/nginx/euer.blog.nix29
-rw-r--r--makefu/2configs/nginx/euer.test.nix14
-rw-r--r--makefu/2configs/nginx/euer.wiki.nix84
-rw-r--r--makefu/2configs/nginx/icecult.nix20
-rw-r--r--makefu/2configs/nginx/public_html.nix17
-rw-r--r--makefu/2configs/nginx/update.connector.one.nix30
6 files changed, 76 insertions, 118 deletions
diff --git a/makefu/2configs/nginx/euer.blog.nix b/makefu/2configs/nginx/euer.blog.nix
index b2a965de..3fb62939 100644
--- a/makefu/2configs/nginx/euer.blog.nix
+++ b/makefu/2configs/nginx/euer.blog.nix
@@ -3,13 +3,9 @@
with import <stockholm/lib>;
let
sec = toString <secrets>;
- ssl_cert = "${sec}/wildcard.krebsco.de.crt";
- ssl_key = "${sec}/wildcard.krebsco.de.key";
hostname = config.krebs.build.host.name;
user = config.services.nginx.user;
group = config.services.nginx.group;
- external-ip = config.krebs.build.host.nets.internet.ip4.addr;
- internal-ip = config.krebs.build.host.nets.retiolum.ip4.addr;
base-dir = "/var/www/blog.euer";
in {
# Prepare Blog directory
@@ -32,24 +28,15 @@ in {
};
};
- krebs.nginx = {
+ services.nginx = {
enable = mkDefault true;
- servers = {
- euer-blog = {
- listen = [ "${external-ip}:80" "${external-ip}:443 ssl"
- "${internal-ip}:80" "${internal-ip}:443 ssl" ];
- server-names = [ "euer.krebsco.de" "blog.euer.krebsco.de" "blog.${hostname}" ];
- extraConfig = ''
- gzip on;
- gzip_buffers 4 32k;
- gzip_types text/plain application/x-javascript text/css;
- ssl_certificate ${ssl_cert};
- ssl_certificate_key ${ssl_key};
- default_type text/plain;
- '';
- locations = singleton (nameValuePair "/" ''
- root ${base-dir};
- '');
+ virtualHosts = {
+ "euer.krebsco.de" = {
+ #serverAliases = [ "blog.euer.krebsco.de" "blog.${hostname}" ];
+ enableSSL = true;
+ enableACME = true;
+ forceSSL = true;
+ root = base-dir;
};
};
};
diff --git a/makefu/2configs/nginx/euer.test.nix b/makefu/2configs/nginx/euer.test.nix
index bff652da..40c37613 100644
--- a/makefu/2configs/nginx/euer.test.nix
+++ b/makefu/2configs/nginx/euer.test.nix
@@ -8,18 +8,16 @@ let
external-ip = config.krebs.build.host.nets.internet.ip4.addr;
internal-ip = config.krebs.build.host.nets.retiolum.ip4.addr;
in {
- krebs.nginx = {
+ services.nginx = {
enable = mkDefault true;
- servers = {
- euer-share = {
- listen = [ ];
- server-names = [ "share.euer.krebsco.de" ];
- locations = singleton (nameValuePair "/" ''
+ virtualHosts."share.euer.krebsco.de" = {
+ locations."/" = {
+ proxyPass = "http://localhost:8000/";
+ extraConfig = ''
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
- proxy_pass http://localhost:8000/;
- '');
+ '';
};
};
};
diff --git a/makefu/2configs/nginx/euer.wiki.nix b/makefu/2configs/nginx/euer.wiki.nix
index 9d0b7487..fefdd6dc 100644
--- a/makefu/2configs/nginx/euer.wiki.nix
+++ b/makefu/2configs/nginx/euer.wiki.nix
@@ -4,13 +4,6 @@ with import <stockholm/lib>;
let
sec = toString <secrets>;
ext-dom = "wiki.euer.krebsco.de";
- acmepath = "/var/lib/acme/";
- acmechall = acmepath + "/challenges/";
-
- #ssl_cert = "${sec}/wildcard.krebsco.de.crt";
- #ssl_key = "${sec}/wildcard.krebsco.de.key";
- ssl_cert = "${acmepath}/${ext-dom}/fullchain.pem";
- ssl_key = "${acmepath}/${ext-dom}/key.pem";
user = config.services.nginx.user;
group = config.services.nginx.group;
@@ -25,8 +18,7 @@ let
# user1 = pass1
# userN = passN
tw-pass-file = "${sec}/tw-pass.ini";
- external-ip = config.krebs.build.host.nets.internet.ip4.addr;
- internal-ip = config.krebs.build.host.nets.retiolum.ip4.addr;
+
in {
services.phpfpm = {
# phpfpm does not have an enable option
@@ -79,24 +71,18 @@ in {
};
};
- krebs.nginx = {
+ services.nginx = {
enable = mkDefault true;
- servers = {
- euer-wiki = {
- listen = [ "${external-ip}:80" "${external-ip}:443 ssl"
- "${internal-ip}:80" "${internal-ip}:443 ssl" ];
- server-names = [
- ext-dom
- "wiki.makefu.retiolum"
- "wiki.makefu"
- ];
- ssl = {
- enable = true;
- # these certs will be needed if acme has not yet created certificates:
- certificate = ssl_cert;
- certificate_key = ssl_key;
- force_encryption = true;
- };
+ virtualHosts = {
+ "${ext-dom}" = {
+ #serverAliases = [
+ # "wiki.makefu.retiolum"
+ # "wiki.makefu"
+ #];
+ enableSSL = true;
+ forceSSL = true;
+ enableACME = true;
+ # recommendedGzipSettings = true;
extraConfig = ''
gzip on;
gzip_buffers 4 32k;
@@ -104,34 +90,26 @@ in {
default_type text/plain;
'';
- locations = [
- (nameValuePair "/" ''
- root ${wiki-dir};
- expires -1;
- autoindex on;
- '')
- (nameValuePair "/store.php" ''
- root ${tw-upload};
- client_max_body_size 200M;
- fastcgi_split_path_info ^(.+\.php)(/.+)$;
- fastcgi_pass unix:${fpm-socket};
- include ${pkgs.nginx}/conf/fastcgi_params;
- include ${pkgs.nginx}/conf/fastcgi.conf;
- '')
- (nameValuePair "/.well-known/acme-challenge" ''
- root ${acmechall}/${ext-dom}/;
- '')
-
- ];
+ locations = {
+ "/" = {
+ root = wiki-dir;
+ extraConfig = ''
+ expires -1;
+ autoindex on;
+ '';
+ };
+ "/store.php" = {
+ root = tw-upload;
+ extraConfig = ''
+ client_max_body_size 200M;
+ fastcgi_split_path_info ^(.+\.php)(/.+)$;
+ fastcgi_pass unix:${fpm-socket};
+ include ${pkgs.nginx}/conf/fastcgi_params;
+ include ${pkgs.nginx}/conf/fastcgi.conf;
+ '';
+ };
+ };
};
};
};
- security.acme.certs."${ext-dom}" = {
- email = "acme@syntax-fehler.de";
- webroot = "${acmechall}/${ext-dom}/";
- group = "nginx";
- allowKeysForGroup = true;
- postRun = "systemctl reload nginx.service";
- extraDomains."${ext-dom}" = null ;
- };
}
diff --git a/makefu/2configs/nginx/icecult.nix b/makefu/2configs/nginx/icecult.nix
index ce4f62e5..e817e55d 100644
--- a/makefu/2configs/nginx/icecult.nix
+++ b/makefu/2configs/nginx/icecult.nix
@@ -10,19 +10,17 @@ let
sha256 = "0l8q7kw3w1kpvmy8hza9vr5liiycivbljkmwpacaifbay5y98z58";
};
in{
- krebs.nginx = {
+ services.nginx = {
enable = true;
- servers.default = {
- extraConfig = ''
- root ${icecult}/app;
+ virtualHosts.default = {
+ root = "${icecult}/app";
+ locations = {
+ "/rpc".proxyPass = "http://10.42.22.163:3121";
+ "/rpc".extraConfig = ''
+ rewrite /rpc/(.*) /$1 break;
+ proxy_http_version 1.1;
'';
- locations = [
- (nameValuePair "/rpc" ''
- rewrite /rpc/(.*) /$1 break;
- proxy_http_version 1.1;
- proxy_pass http://10.42.22.163:3121;
- '')
- ];
+ };
};
};
}
diff --git a/makefu/2configs/nginx/public_html.nix b/makefu/2configs/nginx/public_html.nix
index 9545e98f..676d1f11 100644
--- a/makefu/2configs/nginx/public_html.nix
+++ b/makefu/2configs/nginx/public_html.nix
@@ -3,13 +3,16 @@
with import <stockholm/lib>;
{
- krebs.nginx = {
+ services.nginx = {
enable = true;
- servers.default.locations = [
- (nameValuePair "~ ^/~(.+?)(/.*)?\$" ''
- alias /home/$1/public_html$2;
- autoindex on;
- '')
- ];
+ virtualHosts.default = {
+ default = true;
+ locations = {
+ "~ ^/~(.+?)(/.*)?\$".extraConfig = ''
+ alias /home/$1/public_html$2;
+ autoindex on;
+ '';
+ };
+ };
};
}
diff --git a/makefu/2configs/nginx/update.connector.one.nix b/makefu/2configs/nginx/update.connector.one.nix
index 593f2319..44345dcd 100644
--- a/makefu/2configs/nginx/update.connector.one.nix
+++ b/makefu/2configs/nginx/update.connector.one.nix
@@ -1,25 +1,19 @@
{ config, lib, pkgs, ... }:
with import <stockholm/lib>;
-let
- hostname = config.krebs.build.host.name;
- external-ip = config.krebs.build.host.nets.internet.ip4.addr;
-in {
- krebs.nginx = {
+{
+ services.nginx = {
enable = mkDefault true;
- servers = {
- update-connector-one = {
- listen = [ "${external-ip}:80" ];
- server-names = [
- "update.connector.one"
- "firmware.connector.one"
- ];
- locations = singleton (nameValuePair "/" ''
- autoindex on;
- root /var/www/update.connector.one;
- sendfile on;
- gzip on;
- '');
+ virtualHosts."update.connector.one" = {
+ locations = {
+ "/" = {
+ root = "/var/www/update.connector.one";
+ extraConfig = ''
+ autoindex on;
+ sendfile on;
+ gzip on;
+ '';
+ };
};
};
};