I recently set up a new droplet using the “LEMP on 14.04” stack on DO, and I’m experiencing some issues with permissions for when uploading images or updating plugins in the WordPress admin. I figure this has to do with ownership of the folders. The plugins and uploads folders are currently set to 755. I have one user and group on the server, both named root. How would I easily solve this - adding a secondary group / user and then granting new ownership of the folder? Setting any of the folders to 777 makes everything work but I don’t want that for security reasons.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
The issue is likely because your files are owned by root. Your nginx process would be running as the user “www-data” and so it would not have the needed access to these files. You can change the ownership of your files using the command:
chown -Rf www-data:www-data /usr/share/nginx/html
Using the path to your web root if it is different from the one shown.
Simply put, you need to have nginx run PHP-FPM.
You can look at how to do that by going to the config part in this how-to:
Basically, the part you want:
user = nginx
group = nginx
restart PHP-FPM, then you can just run this on your folder (Change “/path/to/your/website” to the actual path):
cd /path/to/your/website; find . -type d -print0|xargs -0 chmod 755; find . -type f -print0|xargs -0 chmod 644; chown nginx:nginx * -R
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.