I've deployed a webserver using Nginx. The webserver is under a virtual machine using Virtualbox. Everything seems to work properly. Connections are carried out on a local network context.
The problem is that my webpages under the webserver always take 5 seconds to load the first time I'm accessing the webpage. After the initial access, when I reload the page or access again, the webpage shows up instantly. I've disabled browser caching already. Then if I wait for around a minute, the process repeats: when I try to load a webpage it takes 5 seconds.
I'm getting the same behaviour on Edge Chromium and Firefox. I tried with Safari (MacOs) and I'm not getting that behaviour but I believe Safari is using memory caching even if I disabled it.
Up to this point, I'm not sure what it could be. Browsers? Nginx? DNS?
My virtual machine is not sleeping. I've tried changing DNS servers on system preferences. I'm using custom hosts to access my websites hosted on my server (/etc/hosts). I'm using Debian 9 as a server and MacOS Big Sur 11.1 as my host machine.
I'm also using PHP but I tried both pages: plain HTML and PHP and both have the same result.
This problem is making my work a nightmare, since after every change I have to wait for 5 seconds to see the changes.