Nginx-made changes for permissions, ownership, and grouping in webapps

by Arcticooling   Last Updated January 02, 2018 07:00 AM

I have an Ubuntu 16.04 Nginx server environment with several webapps under /var/www/html.

My Nginx user is www-data.

Each time I add A webapp, I execute:

chown www-data:www-data /var/www/html/* -R
find /var/www/html/* -type d -exec chmod 755 {} \;
find /var/www/html/* -type f -exec chmod 644 {} \;

It seems that Nginx changes permissions so at least some directories (and maybe also their files) are becoming unwritable.

My question why would Nginx change my permissions and what's the best way to deal with that?

I could add a daily crontask to bring back the aforementioned permissions changes but some might not see that as a "neat" solution and it's best to change Nginx itself so it won't "dare" changing these permissions again.

Related Questions

Windows Server 2008 r2 security permissions

Updated December 20, 2017 12:00 PM

Remove root permission for specific folder

Updated May 05, 2017 12:00 PM