504timeout

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:

Coresettings

FPM settings, the old values were Dynamic, 20, 2, 1, 3 respectively. New values are on the screenshot:

FPMsettings

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:

Generalsettings

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..

Similar Posts

  • New Web Design

    Plenty of free time recently and I decided to change my website’s theme to follow the latest web trends. This template is dedicated to photography, giving blogging a secondary role. During the porting of old posts to this new design, some links and pictures got broken. If you are here to view or download any…

  • Proxy Server

    Build a proxy server in C using threads and sockets. Every server can have up to two connections on the proxy. Client requests must be satisfied. New servers must be added to a list/array upon a request and must be removed if no request comes within 10 seconds. [Source]

  • PuTTY SSH Tunneling

    This post explains how PuTTy SSH Tunneling can be easily used to bypass firewall rules blocking ports. Let’s say that we have the following setup where only communication via port 22 is allowed between two hosts: Step 1: Open profile and load server’s profile Step 2: Navigate to Connection->SSH->Tunnels and add new port as the…

  • Auction System

    This is an online auction system (like eBay) that lets users add items for sale and purchase items. Users are only allowed to enter bids if they have sufficient funds and when an auction has ended the money are being transfered from the buyer to the seller automatically. An extra feature supported by this auction…

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.