In my previous nixos server install, the answer suggested in this article
like adding systemd.services.nginx.serviceConfig.ProtectHome = "read-only";
to my config worked for me, but isn't working on my current install.
- system: `"x86_64-linux"`
- host os: `Linux 5.15.59, NixOS, 22.11 (Raccoon), 22.11pre398667.39d7f929fbc`
- multi-user?: `yes`
- sandbox: `yes`
- version: `nix-env (Nix) 2.10.3`
- channels(root): `"nixos-22.11pre398667.39d7f929fbc"`
- nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`
I want to host files placed from my user's ~/
so I could easly update/edit files without root privileges.
CodePudding user response:
I would recommend hosting the file in /var/www
(or whatever the default path for hosting is in your distro, if this even changes between distros), create an nginx group and add the user nginx to this group (if there isn't one already), change the group ownership of the files in /var/www
to nginx, and then add your user to the nginx group.
CodePudding user response:
Well the current solution I found/works is setting
services.nginx.user = "whatever_user_owns_the_directory_or_file";