Server is very slow or "504 Gateway Time-out"

My server is running on 16GB of ram and 8x core intel 2.4ghz processor. and it still very slow even after a fresh installation . anyone knows the solution ?

@bahaou Can you share the screenshot of Nginx logsā€¦