Website slow performance in Plesk

There are different options below. Many of them can be combined together:

  1. Enable nginx reverse proxy.
  2. Configure nginx caching for website (Plesk Onyx 17.8 and Plesk Obsidian only)
  3. Enable gzip compression for nginx or for Apache.
  4. Use Speed Kit extension.
  5. Use PHP 7 with opcache.
  • Enable nginx reverse proxy:
    Install the nginx reverse proxy component:
  1. Log in to Plesk.
  2. Go to Tools & Settings and click Updates and Upgrades.

3. On the Updates and Upgrades page, click Add/Remove Components.

4. On the Add/Remove Components page, expand Web hosting and select Nginx web server for installation. Click Continue to begin the installation.

5. Once the component is installed, enable the nginx reverse proxy service in Plesk:
i. Go to Tools & Settings > Services Management.
ii. Click the Start  button next to Reverse Proxy Server (nginx) once and wait. The process will take some time to configure.

To enable nginx Byte-Cache and nginx FastCGI caching, follow these steps:
Enable nginx caching for single domain

  1. Login into Plesk
  2. Go to Domains > example.com > Apache & nginx Settings
  3. Tick the Enable nginx caching option and press the OK button to apply the changes:

Enable nginx caching for all domains using a service plan

  1. Login to Plesk
  2. Go to Service Plans > Hosting Plans tab
  3. Click on the name of the existing plan to edit it.
  4. Go to the Web Server > nginx settings and enable checkbox next to Enable nginx caching:

5. Click Update & Sync

Enable GZIP compression for nginx or for Apache

  • For a Domain In Plesk – Enabling gzip compression for a domain in Plesk

  1. Log in to Plesk.
  2. Go to Domains > example.com > Apache & nginx Settings.
  3. Add the following directives to the Additional nginx directives field:

    gzip on;
    gzip_disable “MSIE [1-6]\\.(?!.*SV1)”;
    gzip_proxied any;
    gzip_comp_level 5;
    gzip_types text/plain text/css application/javascript application/x-javascript text/xml application/xml application/rss+xml text/javascript image/x-icon image/bmp image/svg+xml;
    gzip_vary on;


    Note: This is an example. If needed, add other file types in the gzip_typessection, e.g. application/javascriptapplication/js, etc. The full list of available types can be found on a server in the file /etc/nginx/mime.types.
  4. Apply the changes.
  • For all domains via nginx global configuration – Enabling gzip compression server-wide

  1. Connect to a Plesk server via SSH.
  2. Create the gzip.conf file inside nginx conf.d directory:
    # touch /etc/nginx/conf.d/gzip.conf
  3. Open the file in any text editor. In this example, we are using the vi editor:
    # vi /etc/nginx/conf.d/gzip.conf
  4. Insert the following content in it:

    gzip on;
    gzip_disable “MSIE [1-6]\\.(?!.*SV1)”;
    gzip_proxied any;
    gzip_comp_level 5;
    gzip_types text/plain text/css application/javascript application/x-javascript text/xml application/xml application/rss+xml text/javascript image/x-icon image/bmp image/svg+xml;
    gzip_vary on;


    Note: This is an example. If needed, add other file types in the gzip_typessection, e.g. application/javascriptapplication/js, etc. The full list of available types can be found on a server in the file /etc/nginx/mime.types.
  5. Save the changes and close the file.
  6. Test nginx configuration:
    # nginx -t
  7. Reload nginx configuration to apply the changes:
    # service nginx reload
  8. Now gzip compression is enabled for all domains on the server.
    To verify that gzip compression is enabled, use the command below. When gzip is enabled you will see ‘Content-Encoding: gzip’ in the output:
    Note: If the website has a www redirection, change the website name to www.example.com.
    * If the website is using HTTP connection:
    # curl -s -H “Accept-Encoding: gzip” -I http://example.com | grep -i Content-Encoding
    Content-Encoding: gzip

    * If the website is using HTTPS connection:
    # curl -s -H “Accept-Encoding: gzip” -I https://example.com –insecure | grep -i Content-Encoding
    Content-Encoding: gzip
  • How to enable gzip compression in Apache on Plesk server?
  1. Log into Plesk
  2. Make sure that ‘deflate’ and ‘filter’ modules (‘filter’ might be absent on CentOS 6) are enabled in Tools & Settings > Apache Web Server.

3. Go to Domains > example.com > File Manager and open the .htaccess file.
4. Add the following content to the bottom of the file:

AddOutputFilterByType DEFLATE application/javascript AddOutputFilterByType DEFLATE application/rss+xml AddOutputFilterByType DEFLATE application/vnd.ms-fontobject AddOutputFilterByType DEFLATE application/x-font AddOutputFilterByType DEFLATE application/x-font-opentype AddOutputFilterByType DEFLATE application/x-font-otf AddOutputFilterByType DEFLATE application/x-font-truetype AddOutputFilterByType DEFLATE application/x-font-ttf AddOutputFilterByType DEFLATE application/x-javascript AddOutputFilterByType DEFLATE application/xhtml+xml AddOutputFilterByType DEFLATE application/xml AddOutputFilterByType DEFLATE font/opentype AddOutputFilterByType DEFLATE font/otf AddOutputFilterByType DEFLATE font/ttf AddOutputFilterByType DEFLATE image/svg+xml AddOutputFilterByType DEFLATE image/x-icon AddOutputFilterByType DEFLATE text/css AddOutputFilterByType DEFLATE text/html AddOutputFilterByType DEFLATE text/javascript AddOutputFilterByType DEFLATE text/plain AddOutputFilterByType DEFLATE text/xml BrowserMatch ^Mozilla/4 gzip-only-text/html BrowserMatch ^Mozilla/4\.0[678] no-gzip BrowserMatch \bMSIE !no-gzip !gzip-only-text/html Header append Vary User-Agent
Untitled.png

  • Use Speed Kit Extension
  • Use PHP 7 with opcache
    How to ensure that Opcache is enabled?
    1. Check which PHP handler is used by the website at Domains > example.com > PHP Settings > PHP support ( PHP version …)
php.PNG

Note: According to PHP Documentation, OPcache is available only since PHP 5.5. For PHP 5.2, 5.3 and 5.4 it can be installed as PECL extension.
2. Check if Opcache is enabled for the domain at Domains > example.com > PHP Settings > Performance Settings > opcache.enable “on”

opcache2.png

3. Check if Opcache is enabled for the handler at Tools & Settings > PHP Settings > handler name

opcache.png

Note: Opcache statistics is available at Domains > example.com > PHP Settings > View the php_info() page – cache hits, cache misses.

Scroll to top