Optimize HestiaCP for speed and fast WordPress

HestiaCP is an actively developed fork of popular VestaCP, whos development somewhat stalled in the last little while.

This guide in ispired by excelent post on the official HestiaCP forum by user desp:
How to optimize memory and speed?

Here are three easy steps:

1. Determine hosting/server provider speed

Use excelent YABS script to determine the speed of your hosting solution.

*Geekbench 6 update: since 27 Feb 2023 update YABS uses Geekbench 6 as default benchmark – we’ll use flag -5 to run version 5 so we can compare the results.

wget -qO- yabs.sh | bash  -s -- -5

Or if you just want Geekbench score (skipping disk (fio) -f and network (iperf) -i tests):

wget -qO- yabs.sh | bash -s -- -5fi

Test will return something like this:

Geekbench 5 Benchmark Test:
---------------------------------
Test            | Value                         
                |                               
Single Core     | 832                           
Multi Core      | 867                           
Full Test       | https://browser.geekbench.com/v5/cpu/<test_id_number>

Single core performance is the score we are interested in:

1000 or moreGreat core performance, very good provider
700 – 1000Normal performance, okay provider
500 – 700Normal performance, can be better
500 or lessAwful performance, avoid the provider

Keep in mind, it’s the performance and page speed we’re after, if this is storage/backup optimized server with SAS (spinning) drives, lower numbers are completly accaptable.

Disk performance (IOPS):

fio Disk Speed Tests (Mixed R/W 50/50):
---------------------------------
Block Size | 4k            (IOPS) | 64k           (IOPS)
  ------   | ---            ----  | ----           ----
Read       | 22.76 MB/s    (5.6k) | 173.71 MB/s   (2.7k)
Write      | 22.76 MB/s    (5.6k) | 174.62 MB/s   (2.7k)
Total      | 45.52 MB/s   (11.3k) | 348.33 MB/s   (5.4k)
           |                      |
Block Size | 512k          (IOPS) | 1m            (IOPS)
  ------   | ---            ----  | ----           ----
Read       | 170.55 MB/s    (333) | 213.61 MB/s    (208)
Write      | 179.61 MB/s    (350) | 227.84 MB/s    (222)
Total      | 350.16 MB/s    (683) | 441.45 MB/s    (430)
1000 or moreGreat performance, SSD/NVMe with high IOPS

RAM is not as important unless you’re running into heavy swapping.

Now that we established our KVM VPS / dedi server is fast enough, we can move on to the next step.

2. Lean HestiaCP install

Classic installation of hestiaCP will result in good enough general setup, that works for most, but it costs us performance. It uses Apache as webserver and Nginx only for caching proxy. Apache is slow.

So let’s trim of the fat and install only
Nginx + PHP + MySQL/MariaDB – without Apache.

Let’s use the handy Install string generator:

For example:

wget https://raw.githubusercontent.com/hestiacp/hestiacp/release/install/hst-install.sh

sudo bash hst-install.sh --apache no --phpfpm yes --multiphp no --vsftpd no --proftpd no --named no --mysql yes --postgresql no --exim yes --dovecot yes --sieve no --clamav no --spamassassin no --iptables yes --fail2ban yes --interactive yes

This will give us minimal installation, without BIND (DNS), and only EXIM as mailing solution.

3. Set WordPress template and caching

Login to control panel and your user.

Set tamplate

  • Edit Web domain → Advanced Options → Web Template → WordPress

Set caching

  • Enable Fast CGI Cache
  • Set Cache duration → 5m, 10m
    (if you have a lot of dynamic content, you can try microcache of 30s).

That’s it on the HestiaCP side, now your website should be crazy fast. For further optimisations, look into optimizing WP plugins and theme code.

6 thoughts on “Optimize HestiaCP for speed and fast WordPress

  1. Nuno Monteiro says:

    Hi, i’ve follow the tutorial. Thanks for this.
    But if i want to use docker and containers how can i use these templates to forward to a specific port? I was using hestiacp with apache and used the nginx templates to point to container port in a sub domain.

    server {
    listen %ip%:%proxy_ssl_port% ssl http2;
    server_name %domain_idn% %alias_idn%;
    ssl_certificate %ssl_pem%;
    ssl_certificate_key %ssl_key%;
    ssl_stapling on;
    ssl_stapling_verify on;
    error_log /var/log/%web_system%/domains/%domain%.error.log error;

    include %home%/%user%/conf/web/%domain%/nginx.hsts.conf*;

    location / {
    proxy_set_header Connection ”;
    chunked_transfer_encoding off;
    proxy_buffering off;
    proxy_cache off;
    proxy_pass http://%ip%:8003;
    location ~* ^.+\.(%proxy_extentions%)$ {
    proxy_set_header Connection ”;
    chunked_transfer_encoding off;
    proxy_buffering off;
    proxy_cache off;
    root %sdocroot%/home/user/web/xxx.xxxx.xxx/public_html;
    access_log /var/log/%web_system%/domains/%domain%.log combined;
    access_log /var/log/%web_system%/domains/%domain%.bytes bytes;
    expires max;
    try_files $uri @fallback;
    }
    }

    location /error/ {
    alias %home%/%user%/web/%domain%/document_errors/;
    }

    location @fallback {
    proxy_set_header Connection ”;
    chunked_transfer_encoding off;
    proxy_buffering off;
    proxy_cache off;
    proxy_pass http://%ip%:8003;
    }

    location ~ /\.ht {return 404;}
    location ~ /\.svn/ {return 404;}
    location ~ /\.git/ {return 404;}
    location ~ /\.hg/ {return 404;}
    location ~ /\.bzr/ {return 404;}

    include %home%/%user%/conf/web/%domain%/nginx.ssl.conf_*;
    }

Leave a Reply

Your email address will not be published. Required fields are marked *