Top Nav

Archive | Plesk

Install New Relic With Plesk 12.5

Plesk 12.5 allow for multiple PHP versions and integration methods. This is a great feature but it makes installing New Relic more difficult. New Relic by default installs to the Linux distribution’s version of PHP. With Plesk 12.5, there are multiple PHP versions in different locations. Also New Relic uses a unix socket to facilitate communication between the newrelic-daemon and the PHP component. When running PHP under php-fpm there are permission problems with multiple sites using New Relic. Here are the steps to get New Relic working on CentOS or RedHat. Other Linux distributions will be similar.

1. Install New Relic for the operating system following the standard instructions:

https://docs.newrelic.com/docs/agents/php-agent/installation/php-agent-installation-overview

2. Set the newrelic-daemon to run independently by copying the config file template:

3. Configure the newrelic-daemon to listen on a TCP port instead of a UNIX socket:

4. Start the newrelic-daemon:

5. Configure distribution provided PHP to use newrelic-daemon:

6. Restart Apache

7. Install New Relic on Plesk provided PHP installations using the instructions here:

https://docs.newrelic.com/docs/agents/php-agent/advanced-installation/php-agent-installation-non-standard-php-advanced

We’ll start with PHP 5.6:

8. Set the TCP port

9. Restart cooresponding php-fpm process:

10. Repeat steps 7, 8 and 9 for each additional PHP version installed on the server.

0

Plesk 12 / CentOS / PHP 5.3 Issue Causes “abrt” Crash From Yum

Recent on servers with Plesk 12 and the PHP 5.3 distribution from Odin, we’re seeing “abrt” crash reports from Yum with a back trace like:

Until Odin fixes their repository the only way to get updates to proceed normally is to disable the PHP 5.3 repository by editing:

And adding this line:

Since PHP 5.3 is EOL there aren’t any updates expected so disabling the repository should not cause problems.

 

0

Plesk 12.5 Protected Directories Break Nginx/PHP-FPM

On Plesk 12.5, when using PHP-FPM with Nginx there’s a problem with the way protected directories are implemented. Each protected directory creates a “location” block in the Nginx config that proxies to Apache. So protected directories are implemented in Apache only. Nginx just passes through to Apache.  This is not a great design choice in our opinion. Instead protected directories should be implemented directly in Nginx.

One of the side effects of the 12.5 implementation is that inside protected directories Apache handles PHP even if you have the domain configured to use Nginx with PHP-FPM. This is especially problematic if you have the entire site password protected. The “location /” block takes precedence over the “location *.php” block so the entire sites ends up using Apache instead going directly to PHP-FPM.

To get around this problem I do the following in Plesk:

  1. Create a protected directory for “/protected”.  Add users as needed.
  2. On the “Apache & nginx Settings” screen, add the following to the “Additional nginx directives” field:
  3. In your .htaccess file add:

The last step is important because we need both Apache and Nginx to enforce the protected directory.

 

0

Enable Compression On Plesk With Nginx

To enable compression on a Plesk server with Nginx handling static content, had to add the following to .htaccess:

This configuration is explained here: https://www.a2hosting.com/kb/developer-corner/apache-web-server/data-compression-using-the-mod-deflate-module

And then in Plesk under:

Subscriptions -> acme.com -> Websites & Domains -> Web Server Settings -> Additional nginx directives

added the following:

The Nginx configuration is explained here: http://www.nginxtips.com/how-to-configure-nginx-gzip-compression/

2

Limiting modsec_audit.log On Plesk

The mod_security implementation on Plesk 12 is a great new feature but we’ve noticed a tendency to accumulate very large log files at:

/var/log/modsec_audit.log

This happens on CentOS but not sure if it’s a problem on other distributions.

One way to reduce the logging is to add this line:

to:

Plesk -> Tools & Settings -> Web Application Firewall -> Settings -> Custom directives

Another good step is to add log rotation for the file by creating:

/etc/logrotate.d/modsec

with:

 

0