Apache Configuration

How to Enabled mod_rewrite Debug Log in cPanel

If you are using mod_rewrite & find out some problem, you may need to do some debugging with the log write somewhere. For CentOS system with cPanel together with Apache or LiteSpeed, you may enabled mod_rewrite Debug Log as below.

  • Edit Apache configuration located in “/etc/httpd/conf/httpd.conf
  • Find the corresponding VirtualHost for your domain which you want to debug.
  • Add “RewriteLogLevel 9” underneath “UseCanonicalName” as below and save.
<VirtualHost 100.100.100.100:80>
  ...
  ...
  UseCanonicalName Off
  RewriteLogLevel 9
  ...
  ...
</VirtualHost>
  • Restart Apache or LiteSpeed
  • The Debug Log will be written in “/usr/local/apache/logs/error_log” file.

Fix LiteSpeed and Apache Frequently Restarted in cPanel/WHM

If you are using cPanel/WHM and having a problem where LiteSpeed or Apache frequently restarted, this is the solution.

These graceful restarts are part of the log rotation. If you want to minimize the restarts, then you may want to consider switching to the piped logging option instead for logging.

To do this login to WHM and follow the path below.

WHM → Service Configuration → Apache Configuration → Piped Log Configuration

check “Enable piped Apache logs” then click Save button.

Details about the the log file rotation is available here.