I have a server set with NGINX: https://www.nginx.com/resources/wiki/start/topics/recipes/wordpress/
Recipe
Abridged basic setup
I have deployed WP in this directory: /var/www/blog.example.com/
/var/www
and /var/www/blog.example.com/
does have nginx:nginx file/dir perms.
wp-config.php - 644
wp-content - 755
wp-content/plugins - 755
NGINX is running as nginx
user.
I can browse in entire WordPress site including admin. However, when I want to install a new plugin or update I got always the message:
Installing plugin: iThemes Security (before Better WP Security) 7.9.1
Downloading the installation package from
https://downloads.wordpress.org/plugin/better-wp-security.7.9.1.zip…Decompressing…
An error occurred while installing iThemes Security: Directory could not be created
What’s I am wrong?
All libraries required according to https://make.wordpress.org/hosting/handbook/handbook/server-environment/ was installed.
When I try to upgrade a theme, for example, I got 200 code "OK" from a web server, but, I don’t see anything in the error_log of NGINX.
Also, I’ve checked the php-fpm but I don’t see any updating error.
3
Answers
php-fpm was running as an apache user. I've switched the user into Nginx and It's solved. :D
It looks that the issue is the ‘plugins’ folder writing permissions. WP downloads the zip archive of the plugin then it decompresses it to the ‘plugins’ folder.
This article will help:
https://secure.wphackedhelp.com/blog/fix-file-and-folder-permissions-error-wordpress/
Just adding onto @sincorchetes answer, to those who need more specific instruction:
I changed the lines
to
Then restarted the php-fpm and nginx service