Category: Plesk

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 »

Diffie–Hellman (DHE) Ciphers On Nginx

In some cases you may wish to allow Diffie–Hellman (DHE) ciphers in order to support older clients like IE on Windows 7.  On Plesk we often use the “intermediate” level in the Mozilla cipher set as described here: https://wiki.mozilla.org/Security/Server_Side_TLS The “intermediate” level includes: ECDHE-ECDSA-AES128-GCM-SHA256 ECDHE-RSA-AES128-GCM-SHA256 ECDHE-ECDSA-AES256-GCM-SHA384 ECDHE-RSA-AES256-GCM-SHA384 ECDHE-ECDSA-CHACHA20-POLY1305 ECDHE-RSA-CHACHA20-POLY1305 DHE-RSA-AES128-GCM-SHA256 DHE-RSA-AES256-GCM-SHA384 Of course the “ECDSA” or “Elliptic Curve Digital Signature Algorithm” ciphers will only be available if you are using ECC signed certificates. Additionally the “DHE” ciphers will not be available by default if you are using Nginx releases greater then 1.11. With the 1.11 release Nginx moved the DHE key to an external setting instead of an internally generated key. The stock Nginx packages on Ubuntu and CentoOS do not setup a DHE key which results in the DHE ciphers not being available. To address this problem, start by generating a key:

Next tell Nginx where to find

Read More »

Mixing Plesk open_basedir path syntax

Plesk uses a convoluted syntax for open_basedir settings in Plesk. You can find this setting on a per-domain basis by navigating the Plesk GUI like this: Domains -> example.com -> PHP Settings -> Common settings ->  open_basedir The default setting looks like this:

This breaks down as follows: The first part, {WEBSPACEROOT}{/} means the the entire webspace root, /var/www/vhosts/example.com/ in this case. This includes httpdocs and any folder in this path. The second part {:} is the delimiter. The third part {TMP}{/} means the /tmp directory Any additional paths can be added by appending a normal UNIX-style path syntax as in this example:

In this case the default plus the PHP 7.2 pear directory is allowed. You can add as many directories as needed using the UNIX style path syntax in combination with the Plesk default. Be sure to use a colon as your delimiter.

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.