Score:0

Nginx and a per server's user setting

cn flag

On my local dev machine, I'd like to run an nginx server with several websites, each of them running with a different user that can be either used to run the process and/or at least used to impersonate the user with which files/folders are accessed.

My understanding is that the user setting is located in the /etc/nginx/nginx.conf file and cannot be nested under the server block of the sites configuration.

Is there anything that can be done, without creating docker files or separate virtual machines?

Score:1
ru flag

NGINX does not have per-server user runtimes. If you need that then you need individual independent NGINX instances running with different configs and different sites.

It can be done with stock NGINX (building example setups right now) but you need different listen ports and config roots and cannot use the same config files for each instance. It is probably easier to run each site in a specific docker container or LXD container or VM.

Even in this setup though with containers , non-root users cannot run NGINX on port 80 and many nginx instances cannot bind to 80 and 443 so you still need an NGINX or Apache or haproxy instance to hand off to the specific backends based on hostname.

ru flag
FYI I'm going to try and create some of these configs to share a solution, however the third COVID jab / vaccine is taking a toll on me today, so patience and i'[ll provide a config eventually.
Andrea Moro avatar
cn flag
Take you time and get yourself well. Thanks for the support
Andrea Moro avatar
cn flag
hope your jab was ok? When you have a time, I would love to read your input.
ru flag
@AndreaMoro Jab + Work are taking my time, i'll need some more patience from you before I can provide any kind of working examples
ru flag
@AndreaMoro I'm working on this right now to see if I can make this work, however I'm running into other concerns/issues with the testing - needless to say getting this to work 'properly' is nontrivial so if I run out of space here for my answer once I DO Have this working, I'll have to offload this to a larger blog post or such on my own site for how to do it. I haven't given up though, just work and holidays and stuff keeping me distracted/busy
ru flag
@AndreaMoro so, there're some compiled defaults with nginx in the repos that break the ability to multiuser this. I have not tested with nginx upstream's versions of nginx but wil shortly; however if they have a precompiled default too then it'll be a problem. Standby.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.