Score:0

Suggestions for Nginx file permissions on Ubuntu (VM) server

br flag

Being new to playing with Ubuntu 20.04 (VM) server, I am here to seek suggestions instead of messing up with the system :)

I have Nginx server installed that is ready to serve HTML files from /var/www/html, once file permissions are sorted out. The Nginx server is installed to serve HTML files content to a front-end app. Some ports may be allowed "public access" (external access / beyond network firewall) and in principle, front-end app talks to these ports to show HTML files data in the app. Some HTML files have associated JS and CSS files.

I seek some suggestions to fix permissions for my above use-case. I definitely don't want to run into chmod 777 trap :) Is it sudo chmod -R 755 that I need to serve HTML files to the app? I occasionally need to edit the HTML files as well in the same directory.

I checked the permissions on /var/www/html, and this is what Ubuntu told me.

$ ls -ld /var/www
drwxr-xr-x 3 root root 4096 Jan 11 21:23 /var/www

and

$ ls -ld /var/www/html
drwxr-xr-x 2 root root 4096 Jan 26 23:20 /var/www/html

Apparently, root is the "king" here having all the permissions. My user is not a root user, but I have root privilege since I can run sudo commands without any problems.

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.