aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIsmaël Bouya <ismael.bouya@normalesup.org>2019-05-12 17:06:56 +0200
committerIsmaël Bouya <ismael.bouya@normalesup.org>2019-05-12 17:40:04 +0200
commit9129f327844ca58af61a20582b04e35762c63e35 (patch)
tree6e80c877c5d2bfd9af31983361c183dd4d7f5155
parentd7d031b69f7dfa958d38e96e5ace4b2db023dade (diff)
downloadNix-9129f327844ca58af61a20582b04e35762c63e35.tar.gz
Nix-9129f327844ca58af61a20582b04e35762c63e35.tar.zst
Nix-9129f327844ca58af61a20582b04e35762c63e35.zip
Upgrade httpd config
-rw-r--r--modules/webapps/webstats/default.nix4
-rw-r--r--nixops/modules/websites/apache/httpd_inte.nix23
-rw-r--r--nixops/modules/websites/apache/httpd_prod.nix23
-rw-r--r--nixops/modules/websites/apache/httpd_tools.nix23
4 files changed, 38 insertions, 35 deletions
diff --git a/modules/webapps/webstats/default.nix b/modules/webapps/webstats/default.nix
index feff951..3650e1e 100644
--- a/modules/webapps/webstats/default.nix
+++ b/modules/webapps/webstats/default.nix
@@ -59,8 +59,8 @@ in {
59 trap "rm -f $TMPFILE" EXIT 59 trap "rm -f $TMPFILE" EXIT
60 60
61 mkdir -p ${cfg.dataDir}/${domain} 61 mkdir -p ${cfg.dataDir}/${domain}
62 cat /var/log/httpd/access_log-${domain} | sed -n "/\\[$date_regex/ p" > $TMPFILE 62 cat /var/log/httpd/access-${domain}.log | sed -n "/\\[$date_regex/ p" > $TMPFILE
63 for i in /var/log/httpd/access_log-${domain}*.gz; do 63 for i in /var/log/httpd/access-${domain}*.gz; do
64 zcat "$i" | sed -n "/\\[$date_regex/ p" >> $TMPFILE 64 zcat "$i" | sed -n "/\\[$date_regex/ p" >> $TMPFILE
65 done 65 done
66 ${pkgs.goaccess}/bin/goaccess $TMPFILE --no-progress -o ${cfg.dataDir}/${domain}/index.html -p ${config} 66 ${pkgs.goaccess}/bin/goaccess $TMPFILE --no-progress -o ${cfg.dataDir}/${domain}/index.html -p ${config}
diff --git a/nixops/modules/websites/apache/httpd_inte.nix b/nixops/modules/websites/apache/httpd_inte.nix
index ee7d15e..5046a28 100644
--- a/nixops/modules/websites/apache/httpd_inte.nix
+++ b/nixops/modules/websites/apache/httpd_inte.nix
@@ -151,7 +151,7 @@ let
151 151
152 152
153 loggingConf = (if mainCfg.logFormat != "none" then '' 153 loggingConf = (if mainCfg.logFormat != "none" then ''
154 ErrorLog ${mainCfg.logDir}/error_log 154 ErrorLog ${mainCfg.logDir}/error.log
155 155
156 LogLevel notice 156 LogLevel notice
157 157
@@ -160,7 +160,7 @@ let
160 LogFormat "%{Referer}i -> %U" referer 160 LogFormat "%{Referer}i -> %U" referer
161 LogFormat "%{User-agent}i" agent 161 LogFormat "%{User-agent}i" agent
162 162
163 CustomLog ${mainCfg.logDir}/access_log ${mainCfg.logFormat} 163 CustomLog ${mainCfg.logDir}/access.log ${mainCfg.logFormat}
164 '' else '' 164 '' else ''
165 ErrorLog /dev/null 165 ErrorLog /dev/null
166 ''); 166 '');
@@ -261,8 +261,8 @@ let
261 '' else ""} 261 '' else ""}
262 262
263 ${if !isMainServer && mainCfg.logPerVirtualHost then '' 263 ${if !isMainServer && mainCfg.logPerVirtualHost then ''
264 ErrorLog ${mainCfg.logDir}/error_log-${cfg.hostName} 264 ErrorLog ${mainCfg.logDir}/error-${cfg.hostName}.log
265 CustomLog ${mainCfg.logDir}/access_log-${cfg.hostName} ${cfg.logFormat} 265 CustomLog ${mainCfg.logDir}/access-${cfg.hostName}.log ${cfg.logFormat}
266 '' else ""} 266 '' else ""}
267 267
268 ${optionalString (robotsTxt != "") '' 268 ${optionalString (robotsTxt != "") ''
@@ -419,6 +419,7 @@ let
419 phpIni = pkgs.runCommand "php.ini" 419 phpIni = pkgs.runCommand "php.ini"
420 { options = concatStringsSep "\n" 420 { options = concatStringsSep "\n"
421 ([ mainCfg.phpOptions ] ++ (map (svc: svc.phpOptions) allSubservices)); 421 ([ mainCfg.phpOptions ] ++ (map (svc: svc.phpOptions) allSubservices));
422 preferLocalBuild = true;
422 } 423 }
423 '' 424 ''
424 cat ${php}/etc/php.ini > $out 425 cat ${php}/etc/php.ini > $out
@@ -490,8 +491,8 @@ in
490 default = false; 491 default = false;
491 description = '' 492 description = ''
492 If enabled, each virtual host gets its own 493 If enabled, each virtual host gets its own
493 <filename>access_log</filename> and 494 <filename>access.log</filename> and
494 <filename>error_log</filename>, namely suffixed by the 495 <filename>error.log</filename>, namely suffixed by the
495 <option>hostName</option> of the virtual host. 496 <option>hostName</option> of the virtual host.
496 ''; 497 '';
497 }; 498 };
@@ -534,7 +535,7 @@ in
534 535
535 virtualHosts = mkOption { 536 virtualHosts = mkOption {
536 type = types.listOf (types.submodule ( 537 type = types.listOf (types.submodule (
537 { options = import ./per-server-options.nix { 538 { options = import <nixpkgs/nixos/modules/services/web-servers/apache-httpd/per-server-options.nix> {
538 inherit lib; 539 inherit lib;
539 forMainServer = false; 540 forMainServer = false;
540 }; 541 };
@@ -667,6 +668,9 @@ in
667 '' 668 ''
668 ; Needed for PHP's mail() function. 669 ; Needed for PHP's mail() function.
669 sendmail_path = sendmail -t -i 670 sendmail_path = sendmail -t -i
671
672 ; Don't advertise PHP
673 expose_php = off
670 '' + optionalString (!isNull config.time.timeZone) '' 674 '' + optionalString (!isNull config.time.timeZone) ''
671 675
672 ; Apparently PHP doesn't use $TZ. 676 ; Apparently PHP doesn't use $TZ.
@@ -682,10 +686,7 @@ in
682 686
683 path = 687 path =
684 [ httpd pkgs.coreutils pkgs.gnugrep ] 688 [ httpd pkgs.coreutils pkgs.gnugrep ]
685 ++ # Needed for PHP's mail() function. !!! Probably the 689 ++ optional enablePHP pkgs.system-sendmail # Needed for PHP's mail() function.
686 # ssmtp module should export the path to sendmail in
687 # some way.
688 optional config.networking.defaultMailServer.directDelivery pkgs.ssmtp
689 ++ concatMap (svc: svc.extraServerPath) allSubservices; 690 ++ concatMap (svc: svc.extraServerPath) allSubservices;
690 691
691 environment = 692 environment =
diff --git a/nixops/modules/websites/apache/httpd_prod.nix b/nixops/modules/websites/apache/httpd_prod.nix
index 31904e0..4b646f5 100644
--- a/nixops/modules/websites/apache/httpd_prod.nix
+++ b/nixops/modules/websites/apache/httpd_prod.nix
@@ -151,7 +151,7 @@ let
151 151
152 152
153 loggingConf = (if mainCfg.logFormat != "none" then '' 153 loggingConf = (if mainCfg.logFormat != "none" then ''
154 ErrorLog ${mainCfg.logDir}/error_log 154 ErrorLog ${mainCfg.logDir}/error.log
155 155
156 LogLevel notice 156 LogLevel notice
157 157
@@ -160,7 +160,7 @@ let
160 LogFormat "%{Referer}i -> %U" referer 160 LogFormat "%{Referer}i -> %U" referer
161 LogFormat "%{User-agent}i" agent 161 LogFormat "%{User-agent}i" agent
162 162
163 CustomLog ${mainCfg.logDir}/access_log ${mainCfg.logFormat} 163 CustomLog ${mainCfg.logDir}/access.log ${mainCfg.logFormat}
164 '' else '' 164 '' else ''
165 ErrorLog /dev/null 165 ErrorLog /dev/null
166 ''); 166 '');
@@ -261,8 +261,8 @@ let
261 '' else ""} 261 '' else ""}
262 262
263 ${if !isMainServer && mainCfg.logPerVirtualHost then '' 263 ${if !isMainServer && mainCfg.logPerVirtualHost then ''
264 ErrorLog ${mainCfg.logDir}/error_log-${cfg.hostName} 264 ErrorLog ${mainCfg.logDir}/error-${cfg.hostName}.log
265 CustomLog ${mainCfg.logDir}/access_log-${cfg.hostName} ${cfg.logFormat} 265 CustomLog ${mainCfg.logDir}/access-${cfg.hostName}.log ${cfg.logFormat}
266 '' else ""} 266 '' else ""}
267 267
268 ${optionalString (robotsTxt != "") '' 268 ${optionalString (robotsTxt != "") ''
@@ -419,6 +419,7 @@ let
419 phpIni = pkgs.runCommand "php.ini" 419 phpIni = pkgs.runCommand "php.ini"
420 { options = concatStringsSep "\n" 420 { options = concatStringsSep "\n"
421 ([ mainCfg.phpOptions ] ++ (map (svc: svc.phpOptions) allSubservices)); 421 ([ mainCfg.phpOptions ] ++ (map (svc: svc.phpOptions) allSubservices));
422 preferLocalBuild = true;
422 } 423 }
423 '' 424 ''
424 cat ${php}/etc/php.ini > $out 425 cat ${php}/etc/php.ini > $out
@@ -490,8 +491,8 @@ in
490 default = false; 491 default = false;
491 description = '' 492 description = ''
492 If enabled, each virtual host gets its own 493 If enabled, each virtual host gets its own
493 <filename>access_log</filename> and 494 <filename>access.log</filename> and
494 <filename>error_log</filename>, namely suffixed by the 495 <filename>error.log</filename>, namely suffixed by the
495 <option>hostName</option> of the virtual host. 496 <option>hostName</option> of the virtual host.
496 ''; 497 '';
497 }; 498 };
@@ -534,7 +535,7 @@ in
534 535
535 virtualHosts = mkOption { 536 virtualHosts = mkOption {
536 type = types.listOf (types.submodule ( 537 type = types.listOf (types.submodule (
537 { options = import ./per-server-options.nix { 538 { options = import <nixpkgs/nixos/modules/services/web-servers/apache-httpd/per-server-options.nix> {
538 inherit lib; 539 inherit lib;
539 forMainServer = false; 540 forMainServer = false;
540 }; 541 };
@@ -667,6 +668,9 @@ in
667 '' 668 ''
668 ; Needed for PHP's mail() function. 669 ; Needed for PHP's mail() function.
669 sendmail_path = sendmail -t -i 670 sendmail_path = sendmail -t -i
671
672 ; Don't advertise PHP
673 expose_php = off
670 '' + optionalString (!isNull config.time.timeZone) '' 674 '' + optionalString (!isNull config.time.timeZone) ''
671 675
672 ; Apparently PHP doesn't use $TZ. 676 ; Apparently PHP doesn't use $TZ.
@@ -682,10 +686,7 @@ in
682 686
683 path = 687 path =
684 [ httpd pkgs.coreutils pkgs.gnugrep ] 688 [ httpd pkgs.coreutils pkgs.gnugrep ]
685 ++ # Needed for PHP's mail() function. !!! Probably the 689 ++ optional enablePHP pkgs.system-sendmail # Needed for PHP's mail() function.
686 # ssmtp module should export the path to sendmail in
687 # some way.
688 optional config.networking.defaultMailServer.directDelivery pkgs.ssmtp
689 ++ concatMap (svc: svc.extraServerPath) allSubservices; 690 ++ concatMap (svc: svc.extraServerPath) allSubservices;
690 691
691 environment = 692 environment =
diff --git a/nixops/modules/websites/apache/httpd_tools.nix b/nixops/modules/websites/apache/httpd_tools.nix
index 1b9d1e3..c48d0d2 100644
--- a/nixops/modules/websites/apache/httpd_tools.nix
+++ b/nixops/modules/websites/apache/httpd_tools.nix
@@ -151,7 +151,7 @@ let
151 151
152 152
153 loggingConf = (if mainCfg.logFormat != "none" then '' 153 loggingConf = (if mainCfg.logFormat != "none" then ''
154 ErrorLog ${mainCfg.logDir}/error_log 154 ErrorLog ${mainCfg.logDir}/error.log
155 155
156 LogLevel notice 156 LogLevel notice
157 157
@@ -160,7 +160,7 @@ let
160 LogFormat "%{Referer}i -> %U" referer 160 LogFormat "%{Referer}i -> %U" referer
161 LogFormat "%{User-agent}i" agent 161 LogFormat "%{User-agent}i" agent
162 162
163 CustomLog ${mainCfg.logDir}/access_log ${mainCfg.logFormat} 163 CustomLog ${mainCfg.logDir}/access.log ${mainCfg.logFormat}
164 '' else '' 164 '' else ''
165 ErrorLog /dev/null 165 ErrorLog /dev/null
166 ''); 166 '');
@@ -261,8 +261,8 @@ let
261 '' else ""} 261 '' else ""}
262 262
263 ${if !isMainServer && mainCfg.logPerVirtualHost then '' 263 ${if !isMainServer && mainCfg.logPerVirtualHost then ''
264 ErrorLog ${mainCfg.logDir}/error_log-${cfg.hostName} 264 ErrorLog ${mainCfg.logDir}/error-${cfg.hostName}.log
265 CustomLog ${mainCfg.logDir}/access_log-${cfg.hostName} ${cfg.logFormat} 265 CustomLog ${mainCfg.logDir}/access-${cfg.hostName}.log ${cfg.logFormat}
266 '' else ""} 266 '' else ""}
267 267
268 ${optionalString (robotsTxt != "") '' 268 ${optionalString (robotsTxt != "") ''
@@ -419,6 +419,7 @@ let
419 phpIni = pkgs.runCommand "php.ini" 419 phpIni = pkgs.runCommand "php.ini"
420 { options = concatStringsSep "\n" 420 { options = concatStringsSep "\n"
421 ([ mainCfg.phpOptions ] ++ (map (svc: svc.phpOptions) allSubservices)); 421 ([ mainCfg.phpOptions ] ++ (map (svc: svc.phpOptions) allSubservices));
422 preferLocalBuild = true;
422 } 423 }
423 '' 424 ''
424 cat ${php}/etc/php.ini > $out 425 cat ${php}/etc/php.ini > $out
@@ -490,8 +491,8 @@ in
490 default = false; 491 default = false;
491 description = '' 492 description = ''
492 If enabled, each virtual host gets its own 493 If enabled, each virtual host gets its own
493 <filename>access_log</filename> and 494 <filename>access.log</filename> and
494 <filename>error_log</filename>, namely suffixed by the 495 <filename>error.log</filename>, namely suffixed by the
495 <option>hostName</option> of the virtual host. 496 <option>hostName</option> of the virtual host.
496 ''; 497 '';
497 }; 498 };
@@ -534,7 +535,7 @@ in
534 535
535 virtualHosts = mkOption { 536 virtualHosts = mkOption {
536 type = types.listOf (types.submodule ( 537 type = types.listOf (types.submodule (
537 { options = import ./per-server-options.nix { 538 { options = import <nixpkgs/nixos/modules/services/web-servers/apache-httpd/per-server-options.nix> {
538 inherit lib; 539 inherit lib;
539 forMainServer = false; 540 forMainServer = false;
540 }; 541 };
@@ -679,6 +680,9 @@ in
679 '' 680 ''
680 ; Needed for PHP's mail() function. 681 ; Needed for PHP's mail() function.
681 sendmail_path = sendmail -t -i 682 sendmail_path = sendmail -t -i
683
684 ; Don't advertise PHP
685 expose_php = off
682 '' + optionalString (!isNull config.time.timeZone) '' 686 '' + optionalString (!isNull config.time.timeZone) ''
683 687
684 ; Apparently PHP doesn't use $TZ. 688 ; Apparently PHP doesn't use $TZ.
@@ -694,10 +698,7 @@ in
694 698
695 path = 699 path =
696 [ httpd pkgs.coreutils pkgs.gnugrep ] 700 [ httpd pkgs.coreutils pkgs.gnugrep ]
697 ++ # Needed for PHP's mail() function. !!! Probably the 701 ++ optional enablePHP pkgs.system-sendmail # Needed for PHP's mail() function.
698 # ssmtp module should export the path to sendmail in
699 # some way.
700 optional config.networking.defaultMailServer.directDelivery pkgs.ssmtp
701 ++ concatMap (svc: svc.extraServerPath) allSubservices; 702 ++ concatMap (svc: svc.extraServerPath) allSubservices;
702 703
703 environment = 704 environment =