From b9d01830d381a608641f51c34f2e3b6081221e75 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 14 Feb 2008 14:14:39 +0000 Subject: [PATCH] * In a vhost, merge in the robots.txt for the main server. svn path=/nixos/trunk/; revision=10688 --- system/options.nix | 32 +++++++++++++++------------ upstart-jobs/apache-httpd/default.nix | 12 +++++----- 2 files changed, 24 insertions(+), 20 deletions(-) diff --git a/system/options.nix b/system/options.nix index 3e802253d07d..71cb1a4e305d 100644 --- a/system/options.nix +++ b/system/options.nix @@ -1166,20 +1166,6 @@ "; }; - hostName = mkOption { - default = "localhost"; - description = " - Canonical hostname for the server. - "; - }; - - httpPort = mkOption { - default = 80; - description = " - Port for unencrypted HTTP requests. - "; - }; - httpsPort = mkOption { default = 443; description = " @@ -1235,6 +1221,24 @@ }; }; + virtualHosts = mkOption { + default = []; + example = [ + { hostName = "foo"; + documentRoot = "/data/webroot-foo"; + } + { hostName = "bar"; + documentRoot = "/data/webroot-bar"; + } + ]; + description = '' + Specification of the virtual hosts served by Apache. Each + element should be an attribute set specifying the + configuration of the virtual host. The available options + are the non-global options permissible for the main host. + ''; + }; + subservices = { # !!! remove this diff --git a/upstart-jobs/apache-httpd/default.nix b/upstart-jobs/apache-httpd/default.nix index b04e12c9e317..4586bad5ff13 100644 --- a/upstart-jobs/apache-httpd/default.nix +++ b/upstart-jobs/apache-httpd/default.nix @@ -29,7 +29,9 @@ let in map f defs; - allSubservices = callSubservices (makeServerInfo cfg) cfg.extraSubservices; + mainSubservices = callSubservices (makeServerInfo cfg) cfg.extraSubservices; + + allSubservices = mainSubservices; # !!! should be in lib @@ -150,6 +152,9 @@ let ''; robotsTxt = pkgs.writeText "robots.txt" '' + ${# If this is a vhost, the include the entries for the main server as well. + if isMainServer then "" + else concatMapStrings (svc: svc.robotsEntries) mainSubservices} ${concatMapStrings (svc: svc.robotsEntries) subservices} ''; @@ -276,11 +281,6 @@ let # Always enable virtual hosts; it doesn't seem to hurt. NameVirtualHost *:* - # Catch-all: since this is the first virtual host, any - # non-matching requests will use the main server configuration. - - - ${let perServerOptions = import ./per-server-options.nix { inherit (pkgs.lib) mkOption;