cPanel Request body no files data length is larger than the configured limit

ModSecurity

On a WordPress website hosted on Cpanel server, when editing a page, i get 404 error. On checking ModSecurity logs, found the following Message: Request body no files data length is larger than the configured limit (1048576). Message: collection_store: Failed to access DBM file “/var/cpanel/secdatadir/serverok-session”: Permission denied Apache-Error: [file “apache2_util.c”] [line 277] [level 3] [client … Read more

How to enable Apache SSL module in Ubuntu

Apache web server

To enable the Apache SSL module in Ubuntu, follow these steps Update apt package cache apt update Install Apache SSL module apt install libapache2-mod-ssl Enable the SSL module a2enmod ssl Example # a2enmod ssl Considering dependency setenvif for ssl: Module setenvif already enabled Considering dependency mime for ssl: Module mime already enabled Considering dependency socache_shmcb … Read more

How to configure Security Headers in Apache

Apache web server

Enable HSTS Header set Strict-Transport-Security “max-age=31536000; includeSubDomains; preload” Enable X-Frame-Options Header always append X-Frame-Options SAMEORIGIN Enable X-XSS-Protection Header set X-XSS-Protection “1; mode=block” Enable X-Content-Type-Options Header always set X-Content-Type-Options “nosniff” Enable Referrer-Policy Header always set Referrer-Policy “strict-origin” Enable Content Security Policy (CSP) Header always set Content-Security-Policy “default-src ‘self’; font-src *;img-src * data:; script-src *; style-src *;” … Read more

Apache Website not loading – DDoS

Apache web server

On a Fresh Cpanel Server, after pointing the domain name to the server, the website won’t load. Some times site loads after a very long wait. Apache was working fine and the server load was normal. On checking Apache status in WHM, I found all workers are in use 150 requests currently being processed, 0 … Read more

How to Redirect HTTP to HTTPS using htaccess

Apache web server

To redirect a website from HTTP to HTTPS, you can use the following code in .htaccess file RewriteEngine On RewriteCond %{HTTPS} !=on RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE] If you want to redirect HTTP to HTTPS and keep SSL verification pages on HTTP, this is needed on Cpanel servers. RewriteEngine on RewriteCond %{HTTPS} !=on [NC] RewriteCond %{REQUEST_URI} … Read more

Apache 414 Request-URI Too Long

Apache web server

On an Apache server, when accessing a long URL, got 414 Request-URI Too Long The error is because the URL is too long, this may be a bug with the web applications. If you pass so much data, you should consider using the HTTP POST method instead of GET request. To fix this error, edit … Read more

Change Apache Server MPM in RHEL 8

Apache web server

Apache on RHEL 8 uses events MPM. You can use apachectl -V command to see the current MPM used by Apache. [root@ok ~]# apachectl -V Server version: Apache/2.4.37 (AlmaLinux) Server built: Jan 25 2022 20:48:49 Server’s Module Magic Number: 20120211:83 Server loaded: APR 1.6.3, APR-UTIL 1.6.1 Compiled using: APR 1.6.3, APR-UTIL 1.6.1 Architecture: 64-bit Server … Read more

How to install Apache from source code

Apache web server

To install the latest version of Apache Web Server from source code, go to the apache website, download the latest source code .tar.gz file. https://httpd.apache.org/download.cgi At the time of writing this, the latest version was Apache HTTP Server 2.4.52. cd /usr/local/src wget –no-check-certificate https://dlcdn.apache.org//httpd/httpd-2.4.52.tar.gz tar xvf httpd-2.4.52.tar.gz cd /usr/local/src/httpd-2.4.52 ./configure –prefix=/usr/local/apache –enable-proxy –enable-proxy-connect –enable-proxy-fcgi –enable-remoteip … Read more

Install PHP APC Cache on CentOS 7 using yum

To install APC cache on CentOS 7, run yum install php-pecl-apcu After that, you need to restart the Apache webserver. systemctl restart httpd in phpinfo() page, you will see Files in the packages are [root@localhost ~]# rpm -q –filesbypkg php-pecl-apcu php-pecl-apcu /etc/php-zts.d/40-apcu.ini php-pecl-apcu /etc/php.d/40-apcu.ini php-pecl-apcu /usr/lib64/php-zts/modules/apcu.so php-pecl-apcu /usr/lib64/php/modules/apcu.so php-pecl-apcu /usr/share/doc/pecl/apcu php-pecl-apcu /usr/share/doc/pecl/apcu/NOTICE php-pecl-apcu /usr/share/doc/pecl/apcu/README.md php-pecl-apcu … Read more

Apache 413 Request Entity Too Large

Apache web server

On a CentOS server, when uploading a 100 MB video file in WordPress media manager, I got the following error message Request Entity Too Large The requested resource /wp-admin/async-upload.php does not allow request data with POST requests, or the amount of data provided in the request exceeds the capacity limit. The server had mod_security installed. … Read more