Since you’re using NGINX and PHP-FPM, your files and directories should be owned by the user that is running the PHP-FPM process, not the NGINX user. When you’re using PHP-FPM, NGINX is not handling reading/writing to your files, PHP-FPM is. Even if NGINX were, you don’t want the web server to handle your files for you, PHP-FPM should be.
You can change in to your PHP-FPM directory and check the file in
./pool.d to see who the process is running as.
You should see either
nano to open that file.
In this file, look for:
On a default setup, all four of those should be set to the same user which is normally
www-data. In such a case, your files and directories should be owned by
If you’re web root is
/var/www then simply run:
chown -R www-data:www-data /var/www
and then try writing again.