From 4f9cc2cda3ee1af1e4d780e4454052f865cefd73 Mon Sep 17 00:00:00 2001
From: Aaron  Honeycutt <aaronhoneycutt@protonmail.com>
Date: Wed, 8 Jun 2022 14:45:38 +0000
Subject: [PATCH] LEMP starting file, just has working nginx so far.

---
 lemp.nix | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)
 create mode 100644 lemp.nix

diff --git a/lemp.nix b/lemp.nix
new file mode 100644
index 0000000..5577cf9
--- /dev/null
+++ b/lemp.nix
@@ -0,0 +1,31 @@
+{ config, pkgs, ... }: {
+
+services.nginx = {
+  enable = true;
+  virtualHosts."127.0.0.1" = {
+    root = "/var/www/blog";
+    locations."~ \.php$".extraConfig = ''
+      fastcgi_pass  unix:${config.services.phpfpm.pools.mypool.socket};
+      fastcgi_index index.php;
+    '';
+  };
+};
+
+services.mysql = {
+  enable = true;
+  package = pkgs.mariadb;
+};
+
+services.phpfpm.pools.mypool = {                                                                                                                                                                                                             
+  user = "nobody";                                                                                                                                                                                                                           
+  settings = {                                                                                                                                                                                                                               
+    pm = "dynamic";            
+    "listen.owner" = config.services.nginx.user;                                                                                                                                                                                                              
+    "pm.max_children" = 5;                                                                                                                                                                                                                   
+    "pm.start_servers" = 2;                                                                                                                                                                                                                  
+    "pm.min_spare_servers" = 1;                                                                                                                                                                                                              
+    "pm.max_spare_servers" = 3;                                                                                                                                                                                                              
+    "pm.max_requests" = 500;                                                                                                                                                                                                                 
+   };                                                                                                                                                                                                                                         
+ };
+}