Add php option to the Apache HTTPD service
This commit is contained in:
parent
de5e30ae84
commit
ab6e623d8e
|
@ -21,7 +21,7 @@ in
|
|||
|
||||
simple-webapp-apache = import ./simple-webapp-apache.nix {
|
||||
inherit createManagedProcess logDir runtimeDir forceDisableUserChange;
|
||||
inherit (pkgs) stdenv apacheHttpd writeTextFile;
|
||||
inherit (pkgs) stdenv apacheHttpd php writeTextFile;
|
||||
};
|
||||
|
||||
mysql = import ./mysql.nix {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{createManagedProcess, stdenv, apacheHttpd, writeTextFile, logDir, runtimeDir, forceDisableUserChange}:
|
||||
{instanceSuffix ? "", port ? 80, modules ? [], serverName ? "localhost", serverAdmin, documentRoot ? ./webapp, extraConfig ? "", postInstall ? ""}:
|
||||
{createManagedProcess, stdenv, apacheHttpd, php, writeTextFile, logDir, runtimeDir, forceDisableUserChange}:
|
||||
{instanceSuffix ? "", port ? 80, modules ? [], serverName ? "localhost", serverAdmin, documentRoot ? ./webapp, enablePHP ? false, extraConfig ? "", postInstall ? ""}:
|
||||
|
||||
let
|
||||
instanceName = "httpd${instanceSuffix}";
|
||||
|
@ -76,11 +76,24 @@ import ./apache.nix {
|
|||
${stdenv.lib.concatMapStrings (module: ''
|
||||
LoadModule ${module.name}_module ${module.module}
|
||||
'') modules}
|
||||
${stdenv.lib.optionalString enablePHP ''
|
||||
LoadModule php7_module ${php}/modules/libphp7.so
|
||||
''}
|
||||
|
||||
ServerAdmin ${serverAdmin}
|
||||
|
||||
DocumentRoot "${documentRoot}"
|
||||
|
||||
${stdenv.lib.optionalString enablePHP ''
|
||||
<FilesMatch \.php$>
|
||||
SetHandler application/x-httpd-php
|
||||
</FilesMatch>
|
||||
|
||||
<Directory ${documentRoot}>
|
||||
DirectoryIndex index.php
|
||||
</Directory>
|
||||
''}
|
||||
|
||||
${extraConfig}
|
||||
'';
|
||||
};
|
||||
|
|
|
@ -9,7 +9,7 @@ let
|
|||
pidFile = "${runtimeDir}/${instanceName}.pid";
|
||||
in
|
||||
createManagedProcess rec {
|
||||
name = "tomcat";
|
||||
name = instanceName;
|
||||
inherit instanceName user pidFile postInstall;
|
||||
|
||||
process = "${tomcat}/bin/catalina.sh";
|
||||
|
|
Loading…
Reference in New Issue