3

I'm using an old Macbook Pro (2011) to host a few websites. Everything works fine, but after a long time without hitting the server the websites take a really long time to load (even in my local network) and I can't figure out why.

I imagine that it has to do with the machine entering in a sleep state, or something similar, but that's just a guess.

Any idea of what could be happening?

Things I already did

Turn off Put hard disks to sleep when possible (Preferences->Energy Saver)

Some extra info:

  • macOS version: 10.13.3
  • Server software: Caddy
  • Disabling the sleep mode: InsomniaX
  • I can help create a launchdaemon for you but I need to know: Are there specific times when you would like the computer to go to sleep or not at all? – JBis Apr 8 '18 at 19:50
  • not at all. I would like it to be like my home server, always available. – Pablo Lorenzo Apr 8 '18 at 19:58
  • Great! Check my edited answer. – JBis Apr 8 '18 at 19:59
  • Additionally, I would suggest creating a LaunchDaemon to make it automatically start when it restarts. – JBis Apr 9 '18 at 0:00
3

Take a look a my question over here How to prevent Safari from stopping downloads?. I would mark as an exact duplicate but it is not the same question, only the same answer. The problem that what is occurring is your computer has to wake up from sleep. "But wait InsomniaX is supposed to prevent it from sleeping!" Yes it is. But it does not seem to work in this case.

Since you do not want specific times for the server to wake and sleep I would suggest these settings.

System Preferences>Energy Saver

Computer Sleep: Never

Put Hard disks to sleep when possible: Unchecked

Wake for WiFi Access: Checked

Then open a new Terminal.app in /Applications/Utilities/Terminal.app and enter the following command: caffeinate and leave it running.

You can also create a LaunchDaemon so that caffeinate will start automatically on restart.

P.S. I too use my MacBookPro 2011 as a server. I use it with macOS Server to host websites, file server, VPN, and others. Great use for an old computer.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .