How to fix Synology 504 nginx time-out
I have seen many posts out there with people facing the same issue as I did. The problem was appearing when the websites hosted on my Synology DS215j were having medium to heavy load. WebStation or most likely PHP was causing time-outs and the only way I could resolve this was to restart WebStation service.
There are many reasons that this may be happening but after monitoring my system resources I noticed that the memory consumption was very high due to MANY php73-fpm processes running at the same time. After all my DS215j only has 512MB of RAM, how much can it handle?
The solution was to modify below settings:
WebStation -> PHP Settings -> Edit the PHP profile your websites are running.
Core settings, the old values were 128M, 60, 128 respectively. New values are on the screenshot:
FPM settings, the old values were Dynamic, 20, 2, 1, 3 respectively. New values are on the screenshot:
So if you are also doing the math at this point, the default settings were to create 20 PHP processes with max memory 128M each, which sums up to 2560MB but the system only has 512MB!
And last setting but probably the most important in low RAM systems is to enable the PHP cache in General settings:
Even though this post is about Synology hosted websites, it would probably apply to anyone having similar issues. Hope this post helps someone out there..