Solution: Disabling/enabling Cloudflare in cPanel causes website to crash

Cloudflare offers a number of layers of protection from malicious attacks and also helps with increasing website performance. If you are managing your domains on Cloudflare through cPanel using providers such as Justhost or hostgator, you might encounter a situation where enabling or disabling Cloudflare will cause your site to go offline. Here are some steps you should take to get your site back online ASAP.

  • Login to your server using SSH as root
  • Check whether httpd service is running service httpd status
  • If not running, attempt to restart httpd service service httpd restart
  • If it fails, you will get an error regarding Cloudflare config file. Using vim or nano, edit /etc/apache2/conf.d/includes/pre_main_global.conf and comment out or remove this line /etc/httpd/conf.d/cloudflare.conf
  • Remove the cloudflare.conf from /etc/httpd/conf.d
    • mv
      /etc/httpd/conf.d/cloudflare.conf ~/cloudflare.conf.bak
  • Restart httpd
    • service httpd restart
  • Refresh your website