Score:0

How do I keep NGINX directory ownership after installation on Amazon 2 EC2

ca flag

I have NGINX server set up as proxy to a rails application.

In the main config file /etc/nginx/nginx.conf I've set user to be ec2-user, which is the default user for this instance.

Since NGINX server is installed via sudo (root account), I had to change ownership of the lib directory sudo chown -Rf ec2-user:ec2-user /var/lib/nginx this way in order to be able to show the compiled VueJS parts of the application.

Unfortunately, I now need to run this chown command every time NGINX gets updated by the system, and I am not familiar enough with SysAdmin to ether:

  1. Know why I needed to do that in the first place?
  2. How to automate it post install?
  3. How to bypass this requirement without running NGINX as root?

Can anyone provide answers or suggest a better approach to deployment than I have in place?

ng flag
Nginx should not be getting updated without a sysadmin being involved and aware of it. You'll just have to include the ownership change in your update process. It is a bit of a pain, but unavoidable.
I sit in a Tesla and translated this thread with Ai:

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.