Not many people use the LAMP
stack on NixOS. We don’t have many apache
fans here, most people use nginx
. Anyways, here is the most basic LAMP setup you can get up and running with on NixOS:
{ config, pkgs, lib, ... }:
{
networking.firewall.allowedTCPPorts = [ 80 443 ];
services.httpd.enable = true;
services.httpd.adminAddr = "webmaster@example.org";
services.httpd.enablePHP = true; # oof... not a great idea in my opinion
services.httpd.virtualHosts."example.org" = {
documentRoot = "/var/www/example.org";
# want ssl + a let's encrypt certificate? add `forceSSL = true;` right here
};
services.mysql.enable = true;
services.mysql.package = pkgs.mariadb;
# hacky way to create our directory structure and index page... don't actually use this
systemd.tmpfiles.rules = [
"d /var/www/example.org"
"f /var/www/example.org/index.php - - - - <?php phpinfo();"
];
}
You’ll want to take a quick glance at this guide if you want free ssl certificates.
Your question is broad and general, so feel free to ask specific questions. I do a ton of LAMP sysadmin work on NixOS, so hopefully I’ll have an answer for you.