• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Issue Nginx Cache + Wordpress is not working properly

Fant

New Pleskian
After last update adding posts in wordpress is freezing website.

127.0.0.1 admin [2018-06-15 04:53:14] 'New patch available' ('Update version': '' => '11')
127.0.0.1 admin [2018-06-15 04:53:58] 'Upgrade extension' ('Extension Id': 'wp-toolkit' => 'wp-toolkit', 'Extension Name': 'WordPress Toolkit' => 'WordPress Toolkit', 'Extension Release': '936' => '946', 'Extension Version': '3.2.1' => '3.2.2')

After this update I had php crash and timeout problems (504 errors) when adding new post so I found this whas there
A website is not accessible with "Nginx 504 Gateway Time-out"
But it's not 100% fix. Website was still freezing and timeout but without php crashes.

I found solution, but I think it's temporary because it not fix problem in 100%, some times still got timeouts. We need to add this in "Disable caching for locations":
/wp-admin/post-new.php?wp-post-new-reload=true
/wp-admin/post-new.php
/wp-admin/post.php*

and turn off HTTP no-cache headers are received in request

MhRxWId.png


Im using Plesk Onyx v17.8.11_build1708180301.19 os_Debian 9.4

It's possible to fix in next update?
 
Last edited:
@Fant

This statement

I found solution, but I think it's temporary because it not fix problem in 100%, some times still got timeouts. We need to add this in "Disable caching for locations":
/wp-admin/post-new.php?wp-post-new-reload=true
/wp-admin/post-new.php
/wp-admin/post.php*

is not correct, in the sense that

a) merely adding /wp-admin/ would be sufficient to cover all the request URIs that you specified,

b) the encountered time-out problems have nothing to do with caching, not in any way.


I would highly recommend that you

1 - increase the variables max_execution_time and max_input_time,
2 - increase the variable memory_limit,

under PHP settings of the domain in question.

If that does not work for you, check your Apache Web Server settings: if it is in "Event" mode, just try switching to "Prefork" mode (that can help).

In general, your issue is more likely to be related to PHP and/or FPM and/or Apache related settings and less likely to be related to Nginx: it often is the case that Nginx simply times out due to the fact that the underlying processes of web serving are NOT leading to responses that can be served by Nginx.

In short, first check your web server related settings........preferably without any caching activated.

Hope the above helps a bit and keep me posted!

Regards.........
 
Thanks for resposne!
I disables nginx cache and still got same problem - so it's not cache but it's happend after update .11. I Changed Apache Web Server settings and still got same problem.

I have same 2nd server with similar settings and no problems with freezing wordpress.
My settings:
1OauuSx.png
HWkOHBq.png

Edit: The problem is probably PHP 7.2.7
Edit 2: Changed to php 7.1 and still got same problem.
 
Last edited:
@Fant,

It is probably better if you

1 - change to: FPM application served by Apache;

2 - educe the value for pm.max_children: in general, a value of 50.000 is not recommended at all, keep it relatively low,

3 - reduce the values for max_execution_time and max_input_time to something like 120,

AND inspect your logs for malformed php scripts and/or malicious traffic.

The basic idea behind all of the above is:

a) WordPress is essentially focused on running PHP scripts via a web server like Apache, many plugins are entirely focused on Apache alone: in essence, the "hard work" is done at the Apache level, making it more effective to run FPM via Apache (and in addition, FPM via Nginx is not always the best option),

b) specific PHP scripts and/or plugins are not suitable for the latest PHP versions: in essence, they are malformed in the sense that those scripts/plugins can use deprecated code (read: mostly functions), which can result in a lot of errors and even, in the worst case scenario, a hanging Apache or FPM process,

c) the values for max_execution_time and max_input_time should never be high: in essence, (on the one hand) this keeps bad requests, malformed PHP scripts and so on running, which is not desirable and (on the other hand) malicious traffic has more possibilities to affect the WP instance or the server as a whole,

and that is just of the rough outline of the highly technical explanation behind it.

Furthermore, you have to be aware of the fact(s) that

- the WordPress admin panel does not need a whole lot of execution time and even not a whole lot of memory: for the WP admin panel, config tweaking is barely required,
- running Nginx as a proxy reduces the workload on Apache: config tweaking to increase Apache performance is less relevant when using Nginx,
- running Nginx with caching even reduces the workload on Apache even more: again, config tweaking for Apache performance becomes even less relevant,

and the above implies that one should focus on Nginx caching tweaking.

For instance, in your case it would be better to set the (Nginx) cache time out to a higher value, preferably of to a value of a couple of minutes.

In short, I would recommend that you

- revert the Apache config to the bare minimum and to the default settings where possible,
- optimize the Nginx caching settings,
- check the logs for bad requests, plugins or other (bad) PHP code.

Hope the above helps a bit!

Kind regards............
 
Back
Top