Category: Apache

Fixing “Size of a request header field exceeds server limit.” error

This error from Apache is typically caused by a very large cookie. In Apache the “LimitRequestFieldSize” directive sets this limit. The default is 8190 bytes. To change the file create a file at: /etc/httpd/conf.d/custom.conf or /etc/apache2/conf.d/custom.conf containing the desired change: LimitRequestFieldSize 16384 Reload Apache after adding the file with: /sbin/service apache2 restart or /sbin/service httpd restart

Read More »

Clearing PHP opcache

Great article on how to clear the PHP opcache: https://ma.ttias.be/how-to-clear-php-opcache/ To facilitate use on a Plesk server created script and mapped into namespace: https://acme.com/opcache_clear Here’s the script: And here’s the Apache config to map into a virtual host: This above config should be placed in the “Apache & nginx setting” screen in the “Additional directives for https” field. In addition to setting the alias path we’re also setting the PHP handler. Additionally under “Password protected directories” added password protection for “/opcache_clear”. This is just a placeholder for the password file which is referenced in the above config.

Read More »

Apply Basic Auth To Site With Excluded Virtual Path Under Plesk With Apache 2.4

We want to password protect a WordPress development site but allow unauthenticated access to the wp-json/ path. Hosting platform is Plesk with Apache 2.4. We’ll assume the domain is “acme.com” and the assigned IP is “w.x.y.z”. There are probably better ways to accomplish the goal but this approach seems to work. Step 1. – In Plesk add a Protected Directory named “/donotremove” and add appropriate user/passwords. Step 2. – In Plesk on the “Apache & nginx Setting” screen under “Additional nginx directives” add the following:

Step 3. – In Plesk on the “Apache & nginx Setting” screen under “Additional directives for HTTP” and “Additional directives for HTTPS” add the following:

     

Read More »

.htaccess – negative file type match

Here’s an example of how to block all files extensions not listed in the regular expression:

 

Read More »

Disable Basic Auth For Virtual Path On Plesk

In a recent case we needed to allow request to a particular virtual URL path on a site that was password protected with HTTP Basic Auth. The site was hosted on a Linux server with Plesk, nginx and Apache.  Typically this problem is solved by adding a “Satisfy Any” to the .htaccess in the directory that you want to remove authentication. But this does not work if the path is virtual instead of a physical directory path. Additionally we needed to allow access for a list of IP addresses. We tried an number of different solutions and ended up with the following: Step 1 – The HTTP Basic Auth and IP access controls are configured in the .htaccess file like this:

Step 2 – In Plesk under:

Add the following block:

where “/excluded/path” is the virtual URL to be allowed access and “x.x.x.x” is the IP address assigned

Read More »

Categories

Get a free consultation from Reliable Penguin

Submit the form—or for immediate service call 866-649-7984.