diff --git a/hosts/web-2/configuration.nix b/hosts/web-2/configuration.nix index 3e737fe..fdb179e 100644 --- a/hosts/web-2/configuration.nix +++ b/hosts/web-2/configuration.nix @@ -6,6 +6,7 @@ ./hardware-configuration.nix ../../configuration/common ./bubblesort.nix + ./ip.nix ./meow.nix ]; diff --git a/hosts/web-2/ip.nix b/hosts/web-2/ip.nix new file mode 100644 index 0000000..b5a0199 --- /dev/null +++ b/hosts/web-2/ip.nix @@ -0,0 +1,80 @@ +{ ... }: + +{ + services.nginx.virtualHosts = { + "ip.clerie.de" = { + enableACME = true; + forceSSL = true; + locations."/" = { + return = ''200 ' + + + ip.clerie.de + + + +

ip.clerie.de

+ +

Use bash and curl: curl ip{4,6}.clerie.de

+

Because any other "Whats my IP?"-tool sucks. Host yourself :3

+ + ' + ''; + extraConfig = '' + types { } default_type "text/html; charset=utf-8"; + ''; + }; + }; + "ip4.clerie.de" = { + enableACME = true; + forceSSL = true; + locations."/" = { + return = ''200 "$remote_addr\n"''; + extraConfig = '' + types { } default_type "text/plain; charset=utf-8"; + add_header Access-Control-Allow-Origin *; + ''; + }; + }; + "ip6.clerie.de" = { + enableACME = true; + forceSSL = true; + locations."/" = { + return = ''200 "$remote_addr\n"''; + extraConfig = '' + types { } default_type "text/plain; charset=utf-8"; + add_header Access-Control-Allow-Origin *; + ''; + }; + }; + }; +}