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