Skip to content

Commit 2d4b801

Browse files
committed
Allow nginx to access phpfpm and wordpress
1 parent 4b027b1 commit 2d4b801

1 file changed

Lines changed: 18 additions & 15 deletions

File tree

dev/flake.nix

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -42,20 +42,6 @@
4242
opcache.jit_buffer_size = 8M
4343
upload_max_filesize=1024M
4444
'';
45-
phpfpmConfig = {
46-
pools = {
47-
default = {
48-
settings = {
49-
"catch_workers_output" = "yes";
50-
"pm" = "ondemand";
51-
"pm.max_children" = "5";
52-
};
53-
group = "php";
54-
user = "php";
55-
};
56-
};
57-
phpOptions = phpOptions;
58-
};
5945
nixosModules = {
6046
wordpress-server = {
6147
security.sudo.extraRules = [{
@@ -67,10 +53,11 @@
6753
}];
6854
services.memcached = memcachedConfig;
6955
services.mysql = mysqlConfig;
70-
services.phpfpm = phpfpmConfig;
7156
# Create the home dir on the volume
7257
systemd.tmpfiles.rules = [ "d /home/www 0755 www www -" ];
58+
users.users.nginx = { extraGroups = [ "www" ]; };
7359
users.users.php = {
60+
extraGroups = [ "www" ];
7461
isSystemUser = true;
7562
group = "php";
7663
};
@@ -256,12 +243,28 @@
256243
httpConfig = nginxHttpConfig "/home/www/wordpress"
257244
config.services.phpfpm.pools.default.socket;
258245
};
246+
services.phpfpm = {
247+
pools = {
248+
default = {
249+
settings = {
250+
"catch_workers_output" = "yes";
251+
"listen.owner" = config.services.nginx.user;
252+
"pm" = "ondemand";
253+
"pm.max_children" = "5";
254+
};
255+
group = "php";
256+
user = "php";
257+
};
258+
};
259+
phpOptions = phpOptions;
260+
};
259261
services.wordpress-installer = {
260262
enable = true;
261263
package =
262264
(wpInstaller "localhost" "www" "/home/www/wordpress");
263265
user = "www";
264266
};
267+
systemd.services.nginx.serviceConfig.ProtectHome = false;
265268
})
266269
{
267270
networking.hostName = "wordpress-firecracker";

0 commit comments

Comments
 (0)