diff --git a/hosts/marauder/www.nix b/hosts/marauder/www.nix index a46e807..3e6544d 100755 --- a/hosts/marauder/www.nix +++ b/hosts/marauder/www.nix @@ -1,60 +1,26 @@ -{ pkgs, config, inputs, ... }: -{ +{ pkgs, inputs, ... }: +let + fortune = pkgs.writeShellScript "cgi" '' + echo "Content-type: text/html" + echo "" + ${pkgs.fortune}/bin/fortune + ''; +in { services.mysql = { enable = true; package = pkgs.mariadb; }; - users.groups.www = {}; - - users.users.www = { - isSystemUser = true; - home = "/var/www"; - group = "www"; - }; - - services.phpfpm = { - pools = { - php = { - user = "www"; - settings = { - "listen.owner" = config.services.caddy.user; - "pm" = "static"; - "pm.max_children" = 1; - "php_admin_value[error_log]" = "stderr"; - "php_admin_flag[log_errors]" = true; - "php_flag[display_errors]" = true; - "catch_workers_output" = true; - }; - }; - php56 = { - user = "www"; - phpPackage = inputs.phps.packages.x86_64-linux.php56; - settings = { - "listen.owner" = config.services.caddy.user; - "pm" = "static"; - "pm.max_children" = 1; - "php_admin_value[error_log]" = "stderr"; - "php_admin_flag[log_errors]" = true; - "php_flag[display_errors]" = false; - "catch_workers_output" = true; - }; - }; + services.httpd = { + enable = true; + enablePHP = true; + # phpPackage = inputs.phps.packages.x86_64-linux.php74; + extraConfig = '' + ScriptAlias /fortune ${fortune}/bin/fortune + ''; + virtualHosts."localhost" = { + documentRoot = "/var/www"; + locations."/".index = "index.html index.php"; }; }; - - services.caddy = { - enable = true; - virtualHosts."localhost".extraConfig = '' - root * /var/www - file_server - tls internal - handle /phpmyadmin/* { - php_fastcgi unix/${config.services.phpfpm.pools.php56.socket} - } - handle { - php_fastcgi unix/${config.services.phpfpm.pools.php.socket} - } - ''; - }; }