Problem: I'm using wordpress on LNMP environment. My site works just fine, but when installing themes / plugins, it does not work and reports a 504 error.
- Nginx and php (at least sometimes) communicate fine, since I can see my site display normally.
- FTP host, user name and password are correct, since when installing themes or plugins, (at least some) files are downloaded into theme or plugin folder (but not the whole theme or plugin).
- FTP user and Nginx user do have permission to access to the folder, which is owned by FTP user. (FTP & Nginx users are in same group and the folder is set to 775)
- i tried bigger fastcgi_read_timeout values (e.g. 300), but it did not help.
Details When I run into the problem, I did what people normally do. I went to GOOGLE and set fastcgi_read_timeout to bigger values, as I remember this worked for me on other severs. This, however, only have me wait for 5 min before get the error report (300 s = 5 min). I also tried bigger fastcgi_buffer_size, which also did not work. I think this has something to do with installing theme or plugin, since the web page itself displays fine and error only occurs when installing.When installation failed, I find (not complete plugin) files in plugin folder.
Nginx error log:
2017/07/22 07:42:26 [error] 2672#2672: *283 upstream timed out (110: Connection timed out) while reading response header from upstream, client: my.client.ip.adderss, server: name.of_my_server, request: "POST /wp-admin/admin-ajax.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "name.of_my_server", referrer: "http://my.domain/wp-admin/plugin-install.php?s=best+CAPTCHA&tab=search&type=term"
(There are many entries similar to this one.)
Interestingly, wordpress displays error as:
Installation failed: 504 Gateway Time-out 504 Gateway Time-out nginx/1.10.3 (Ubuntu) <!-- a padding to disable MSIE and Chrome friendly error page --> <!-- a padding to disable MSIE and Chrome friendly error page --> <!-- a padding to disable MSIE and Chrome friendly error page --> <!-- a padding to disable MSIE and Chrome friendly error page --> <!-- a padding to disable MSIE and Chrome friendly error page --> <!-- a padding to disable MSIE and Chrome friendly error page -->
Half of that message certainly should not be shown. Perhaps there is something wrong here.
php-fpm's log shows no error, neither does wordpress' log when enabling logging.
- nginx 1.10.3
- mysql Ver 14.14 Distrib 5.7.19
- PHP 7.0.18-0ubuntu0.16.04.1
- wordpress 4.8
- Ubuntu 16.04.2 LTS