Plesk

How to set up Apache to restart daily in Plesk

Question

Websites become temporarily unavailable when applying configuration changes. How to set up Apache restart every day at a certain time?

Answer

Plesk does not have a direct functionality to schedule Apache restarts at a particular time of the day.
Apply one of the following alternatives:

Configure Apache to maintain HTTP connections when applying new configurations:

  1. Configure Apache graceful restart
  2. Set Apache restart interval to 0 in Tools & Settings > Apache Web Server

  3. Install Watchdog extension to monitor Apache

Create a scheduled task to restart Apache every day:

  1. Log in to Plesk

  2. Set Apache restart interval to 9999 in Tools & Settings > Apache Web Server

  3. Go to Tools & Settings > Schedule Tasks and add the task, for example, for CentOS/RHEL/CloudLinux:

    Note: for Debian/Ubuntu, the command should be "/usr/sbin/service apache2 restart".

Note: In case the first option is applied, the websites will always stay accessible. However, in certain environments, Apache graceful restart may not be stable. For this reason, Watchdog service monitor should be installed.