skip to Main Content

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.

2

Answers


  1. Chosen as BEST ANSWER

    Okay, nginx can read from /var so my workaround is to use /var/www/website and ln -s /var/www/website ~/website .

    *quoting from discourse.nixos.org


  2. 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.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search