nginx: Add default runas.rocks virtualhost

This commit is contained in:
Giulio De Pasquale 2022-11-27 11:24:35 +01:00
parent b93d3a33b0
commit 7ffddeca09

View File

@ -1,18 +1,10 @@
{ services, pkgs, lib, ... }: { services, pkgs, lib, ... }:
let
serviceSkeleton = { default ? false }: {
inherit default;
{
services.nginx = {
enable = true;
package = pkgs.openresty;
recommendedGzipSettings = true;
recommendedOptimisation = true;
recommendedProxySettings = true;
recommendedTlsSettings = true;
virtualHosts."architect.devs.giugl.io" = {
default = true;
enableACME = true; enableACME = true;
addSSL = true; forceSSL = true;
root = "/var/lib/nginx/error_pages"; root = "/var/lib/nginx/error_pages";
extraConfig = "error_page 404 /index.htm;"; extraConfig = "error_page 404 /index.htm;";
@ -26,7 +18,20 @@
"/wat.jpg" = { }; "/wat.jpg" = { };
}; };
}; };
appendHttpConfig = let in {
services.nginx = {
enable = true;
package = pkgs.openresty;
recommendedGzipSettings = true;
recommendedOptimisation = true;
recommendedProxySettings = true;
recommendedTlsSettings = true;
virtualHosts."architect.devs.giugl.io" = serviceSkeleton { default = true; };
virtualHosts."runas.rocks" = serviceSkeleton {};
appendHttpConfig =
let
extraPureLuaPackages = with pkgs.luajitPackages; [ extraPureLuaPackages = with pkgs.luajitPackages; [
lua-resty-openidc lua-resty-openidc
lua-resty-http lua-resty-http
@ -36,7 +41,8 @@
]; ];
luaPath = pkg: "${pkg}/share/lua/5.1/?.lua"; luaPath = pkg: "${pkg}/share/lua/5.1/?.lua";
makeLuaPath = lib.concatMapStringsSep ";" luaPath; makeLuaPath = lib.concatMapStringsSep ";" luaPath;
in '' in
''
lua_package_path '${makeLuaPath extraPureLuaPackages};;'; lua_package_path '${makeLuaPath extraPureLuaPackages};;';
lua_ssl_trusted_certificate /etc/ssl/certs/ca-certificates.crt; lua_ssl_trusted_certificate /etc/ssl/certs/ca-certificates.crt;
lua_ssl_verify_depth 5; lua_ssl_verify_depth 5;