Cannot install plugin or updates in WordPress - wordpress

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.

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:
vim /etc/php-fpm.d/www.conf
I changed the lines
user = apache
group = apache
to
user = nginx
group = nginx
Then restarted the php-fpm and nginx service
systemctl restart php-fpm
systemctl restart nginx

Related

wordpress cant able to install any plugins showing error------ Installation failed: Download failed. No working transports found?

In my wordpress when I trying to install any plugins it shows the error(Installation failed: Download failed. No working transports found).I enabled both curl and openssl in my server and also restarted server.But still the issue not resolved.I am using AWS server.Kindly help anyone.
Please add this to the Apache config file:
Below this line: #LoadModule xml2enc_module modules/mod_xml2enc.so
# load curl and open ssl libraries
LoadFile “C:\php\libeay32.dll”
LoadFile “C:\php\ssleay32.dll”
LoadFile “C:\php\libssh2.dll”
And above this line: <IfModule unixd_module>
Stop Apache server using : service httpd stop
Start Apache server using: service httpd start
This should help.

Wordpress - The ssh2 PHP extension is not available

I use SSH keys in my wp-config since a long time. Updates, plugin installation and removal, all worked well. After the last apt-get update wp is asking for the FTP password when I try to install for example a plugin.
There was no change done to the wp installation nor the file or directory permissions. I did not update wp either.
define('FTP_PUBKEY','/home/wp-user/wp_rsa.pub');
define('FTP_PRIKEY','/home/wp-user/wp_rsa');
define('FTP_USER','wp-user'); define('FTP_PASS','');
define('FTP_HOST','127.0.0.1:22');
Ubuntu 14.04
WORDPRESS VERSION: 4.7.6
PHP VERSION: 5.5.9-1ubuntu4.22
WEB SERVER INFO: Apache/2.4.7 (Ubuntu) OpenSSL/1.0.1f
EDIT:
I added below to my wp-config to see if it changes something.
define('FS_METHOD', 'ssh2');
No I'm getting a different error message in the WP backend:
The ssh2 PHP extension is not available
...but ssh2 is installed and loaded:
# php -m |grep ssh2
ssh2
Seems to be a bug in libssh2-php...
https://bugs.launchpad.net/ubuntu/+source/php-ssh2/+bug/1617294
Installing the WP plugin below allows me again to install/update as before.
https://en-ca.wordpress.org/plugins/ssh-sftp-updater-support/#description

What is the cause of the "502 Bad Gateway" after Ghost 1.8.7 update

I recently installed Ghost 1.8.4 and Nginx on my AWS ec2 Ubuntu 16.04 server. When I loaded my blog site, it correctly took me to the Ghost home page, from where I logged into Ghost admin. On the admin screen, there was a message to update.
I ran ghost update in putty
The update appeared to be successful, but when I returned to my blog site, I received the following error:
502 Bad Gateway
nginx/1.10.3 (Ubuntu)
Does anyone know a probably cause of this error and how to resolve?
I checked some posts, which suggested I should have turned Ghost off before the update. If this is true, is my ghost installation now corrupted?
I went to my ghost directory in /var/www/ghost and tried to run:
sudo service ghost start
but it returned:
Failed to start ghost.service: Unit ghost.service not found
and trying to stop, returns Unit ghost.service not loaded. Am I running the command from the correct location?
I've experienced 502 issues with ghost behind nginx several times over a few years of running it. I'm not sure if the cause of mine today is the same as yours, but what I observed was that after a restart ghost had changed its port number to one different than what its nginx config was listening on.
I followed these directions from https://web.archive.org/web/20200807095031/https://www.danwalker.com/running-ghost-on-a-5-digital-ocean-vps/ which resolved it for me:
See which port ghost is running on:
sudo netstat -plotn
Check that it matches the proxy_pass in the nginx config file in /etc/nginx/sites-enabled.
In my case the port in the nginx config had incremented to 2369 while the actual node process was running on 2368. Changing the proxy_pass port back to 2368 in my ghost blog's nginx config file resolved the issue for me.
I ran into the same problem after upgrading ghost.
Make sure the port number configured in your ghost's config file and the proxy_pass in your ghost site's nginx configuration files match.
Check the port number in
/var/www/ghost/config.production.json matches the proxy_pass port in the nginx config files.
/var/www/ghost/system/files/<yourDomainName>.<extension>.conf
/var/www/ghost/system/files/<yourDomainName>.<extension>-ssl.conf
In my case I had to change 2368 to 2369 in the nginx config files to fix the issue.
Make sure you restart your ghost and nginx after you make the changes.
# restart your ghost site
cd /var/www/ghost/
ghost restart
# restart nginx
sudo systemctl restart nginx
Hope this helps someone.
Apparently when I posted this issue it was due to a bug in the Ghost CLI that the ghost team were in the process of fixing.
They provided me with these instructions to run on my server:
systemctl stop ghost_www-blogwebsite-com
ghost update --force
The resulting output:
stopping Ghost [skipped]
Removing old Ghost versions [skipped]
This fixed the problem and updated to the correct version.

Redmine under sub-directory on nginx

My vhost configuration: http://pastebin.com/ZyXUmQtx (only one domain on this installation)
I've been racking my head and Google for a solution the last two days and can't quite seem to come up with a solution that works.
My setup (from the above configuration):
IP.Board 3.4 installation in %root_domain%/forums/
IP.Content 2.3 installation in %root_domain/forums/ (with external access index.php on the top-level)
Redmine 2.2.2 install at /usr/share/redmine (this is working because Thin is running and there are no errors in either log file)
Stale phpMyAdmin configuration at /usr/share/phpmyadmin/ that also kinda doesn't load html/css properly.
Symlink to /usr/share/redmine/public to /srv/www/tiberian-genesis.net/public_html/redmine
I'm trying to get redmine setup to run under %root_domain%/redmine/, but I keep getting a 404 page from my IP.Content installation.
Accessing it takes me to the url: /redmine/login?back_url=http://redmine_thin_servers/redmine/ (which now that notice it, it seems to not like my upstream...)
In case someone requests the Thin configuration file:
---
pid: /var/run/thin/redmine.pid
group: tgmod
prefix: /redmine
timeout: 30
log: /var/log/thin/redmine.log
max_conns: 1024
require: []
max_persistent_conns: 512
environment: production
user: tgmod
servers: 1
daemonize: true
chdir: /usr/share/redmine
socket: /var/run/thin/redmine.sock
I'm out of ideas here.
Thanks in advance!
I just ended up setting it up on a sub-domain. I wanted to try to proxy it on a sub-directory, but my main website kept interfering with the rules.

Nginx - 502 bad gateway from changing user in nginx.conf

If I change the user parameter in nginx.conf from:
user www-data
to
user www www
www is a user and www is also a group (existing already)
it says 502 bad gateway
How would I successfully be able to run nginx as the www user.
Cheers
You will need to use the command
chown -R www:www "Document Root"
This will ensure that all of your web files are owned by that user and group meaning nginx can access them.
If yopu have any .php files in your document root you will also have to go to your php fpm config file and change the lines
listen.owner = www
listen.group = www
If you are running centos go to:
/etc/php.fpm.d
where you will find the www.conf file to find those settings.
Hope that helps.
You should also change user in /etc/php/7.0/fpm/pool.d/www.conf(Ubuntu 16.10) file
listen.owner = www
listen.group = www
This error appears when you change nginx process user without changing this params in php-fpm.
After that restart php-fpm process:
service php7.0-fpm restart (for php 7.0)
The error may be caused if your are passing the request to fastcgi(php), to do this nginx has to access the file /run/php/php7.4-fpm.sock (for php7.4), I checked the logs and found out that it was denied the permission to access this file.
I ran this command:
> sudo chown ubuntu /run/php/php7.4-fpm.sock
and then it worked correctly.

Resources