Nginx – Running nginx, should wordpress files be set to www-data or root or

nginxpermissionsSecurityWordpress

I am running nginx, which I understand runs under the www-data user account.

All my wordpress related files are currently set to root root, is this normal?
Or should they be set the www-data account (and group?)

Best Answer

I think they should be chowned to www-data:www-data. This is somewhat more secure, because if your site gets compromised, and you had a file that was owned as root, and had the executable permissions, it would be a hell of a lot easier to run a command as root, than if all the files and directories were owned by a non-privileged user.

As long as nginx runs as www-data, you shouldn't have any trouble having the files owned by the same user