Top Nav

Archive | Plesk

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

Plesk & New Relic

New Relic is a great tool for managing website performance. Recently worked to setup a Plesk 12 server with New Relic. We wanted to have each virtual host on the website represented by an Application in New Relic as documented here:

https://docs.newrelic.com/docs/agents/php-agent/configuration/php-directory-ini-settings

We found a few useful points that we want to share:

1. The newrelic.appname must be removed from /etc/php.d/newrelic.ini.  If the appname is defined in this file then individual virtual hosts will not be able to override and provide there own appname. Just edit the file and comment out the line like:

2. Set the appname for each virtual host from Plesk by going to:

and adding a line like this:

to the “Additional configuration directives” field. Notice that the appname has two components separated by a semicolon. The first is the domain for the site and the second is the fully qualified server hostname. So for example you might do:

and then another site on the server might be:

Now in New Relic, you’ll see three applications. One for store.acme.com, one for blog.acme.com and one for the entire server called web1.acme.com.

2

Revoke MySQL DROP Privilege On Plesk Database User

Had a request from client to add database user on a Plesk server but to remove the DROP DATABASE privilege so that they could not accidentally delete their database. By default, database users created through Plesk do have the DROP DATABASE privilege. Plesk does not currently allow fine-grained control over database privileges so the only way to implement this change is to modify the privileges directly from a MySQL command line. After some testing we found these command will have the desired effect:

Of course replace “testdb” and “testdbuser” with your actual database and username.

0

Set X-Robots-Tag Header On Plesk/Nginx

On a Plesk server with Nginx enabled here are the steps to setup custom X-Robot-Tag headers has described here:

https://developers.google.com/webmasters/control-crawl-index/docs/robots_meta_tag?csw=1

In Plesk control panel:

1. Select the domain

2. Click Web Server Settings

3. Scroll down to nginx settings

4. If you have “Serve static files directly by nginx” checked (which I recommend), you’ll need to remove the file extensions to which you’re going to apply headers. In this example remove “pdf” from the list.

5. In the “Additional nginx directives” field enter:

6. Click OK button to save changes.

0