Created
June 2, 2014 20:07
-
-
Save chrisfarms/6fe85f04b0e349ff60a3 to your computer and use it in GitHub Desktop.
Sketchy LAMP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ config, pkgs, ... }: | |
let | |
srcDir = builtins.toString ./.; | |
dataDir = "/var/data/"; | |
mysqlpass = "v3rys3cr3t"; | |
in { | |
system.activationScripts.uploadsDir = '' | |
mkdir -p "${dataDir}" | |
chown -R wwwrun:wwwrun "${dataDir}" | |
''; | |
networking.firewall.allowedTCPPorts = [ 80 443 ]; | |
services.httpd = { | |
enable = true; | |
phpOptions = '' | |
short_open_tag=On | |
''; | |
virtualHosts = [{ | |
hostName = "*"; | |
documentRoot = "${srcDir}"; | |
extraConfig = '' | |
SetEnv RES_DATABASE "mysql://root:${mysqlpass}@localhost/mydatabase" | |
SetEnv RES_DATA_DIR "${dataDir}" | |
<Directory "${srcDir}"> | |
Options -Indexes | |
AllowOverride All | |
Order allow,deny | |
Allow from all | |
DirectoryIndex index.php | |
</Directory> | |
Alias /library ${dataDir} | |
<Directory "${dataDir}"> | |
Options -Indexes | |
AllowOverride All | |
Order allow,deny | |
Allow from all | |
DirectoryIndex index.php | |
</Directory> | |
''; | |
}]; | |
}; | |
services.mysql = { | |
enable = true; | |
package = pkgs.mysql55; | |
rootPassword = pkgs.writeTextFile { name = "mysqlpw"; text = mysqlpass; }; | |
initialDatabases = [{ | |
name = "mydatabase"; | |
schema = ./init.mysql; | |
}]; | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment