apache shutdown error , couldn’t release the accept mutex

to fix apache error

couldn’t release the accept mutex

in debian & ubuntu

do that

  1. Create the following file: /etc/apache2/conf-available/mutex.conf
  2. Add Mutex file:${APACHE_LOCK_DIR} default inside the newly created file
  3. Enable new configuration file with a2enconf mutex
  4. Restart Apache with systemctl restart apache2

blocking direct requests that bypass Cloudflare when using mod_remoteip

  1. Enable mod_remoteip
    $ sudo a2enmod remoteip
  2. Add “RemoteIPHeader X-Forwarded-For” to the Apache configuration
  3. Change the Apache log format, substituting %h for %a

Find the matching LogFormat line in your Apache conf and change:

LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined

to:

LogFormat "%a %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined

Example, blocking direct requests that bypass Cloudflare:

  1. Modify Apache configuration for a particular site:

<Directory /var/html/website/public>
Order deny,allow
Deny from all
Allow from 173.245.48.0/20