My Nginx dedicated server has 4 CPU cores and 16GB of memory, the resources should be sufficient, but it crashes frequently (with a 504 error) due to limitations related to the CPU and PHP subprocesses.
I'm trying to find the reason. In WordPress, I have the following warning: A PHP session was created via the session_start() function call. This interferes with REST API and loopback requests. Before making any HTTP requests, the session should be closed via session_write_close().
Could this cause a 504 error?
A REST API should be stateless. In this case, the session is of no use. It's hard to know for sure without more information. A 504 (timeout) error may occur if PHP starts a session in the background without proper configuration (e.g. Redis), where a custom session handler can store the session. use
Find your PHP logs and other settings. Post here. You can also use the shell to view the configuration.
Please note that most systems run different PHP settings for cli and web requests. Use
top
orhtop
to view system tools that process results with high CPU and memory usage.