Before I continue, I just want to mention that I search everywhere for solution and tried many many configurations and couldn't resolve the issue.
I installed wordpress (on 3 different servers to test) on ubuntu 18.04 with nginx, php 7.2 and mysql.
After about 20-30 min of idle (no requests to the server), it takes around 30-40 seconds for the site to load. After this initial load, everything works perfect (I disabled caching), no matter if you login from a different computer.
I just want to mention that it's a clean wordpress installation.
I've tried playing with nginx configuration file but I noticed that requesting html files (no using php) works fine so my conclusion was that it's somehow relates to php, so I tried to modify the config file which results in the same behavior.
I'm sure that I'm missing something here and I hope you can help me resolve this.
Tell me if you need more information.