Questions? Feedback? powered by Olark live chat software
Knowledgebase
Author Avatar

Guide to Magento Optimization on cP VPS

Written by: on 05 March 2020 09:14 AM 05 March 2020 09:14 AM

Find a complete guide to Magento Optimization on a cPanel VPS. The step by step instructions to do this yourself.

A complete guide to Magento Optimization on a cPanel VPS. The step by step instructions to do this yourself are below.

We also offer this service for $20 to our VPS clients, you can order here: https://www.vpsblocks.com.au/clients/cart.php?a=add&pid=68&carttpl=cart

Also note that steps 1-3 can speed up any cPanel hosted CMS (Joomla, Wordpress, Prestashop etc.), while the rest of the steps are specific to Magento.

1. Install Zend OPCache - Note this is unnecessary on recently provisioned servers as we now have this as part of the cPanel template
It's important to run one of the best caching modules available, and OPCache (formally APC) is one of the best. The instructions to do this are located in a separate knowledgebase article, click here

2. Install EnginTron
EnginTron provides some minor speed increases. The instructions to do this are located in a separate knowledgebase article, click here

3. MySQL Tweaks

  • SSH to your VPS
  • Type: nano /etc/my.cnf
  • Add any of the following lines that are missing or adjust their values:
[mysqld]
innodb_file_per_table=1
open_files_limit=10240
max_allowed_packet=256M
key_buffer_size = 512M
sort_buffer_size = 4m
read_buffer_size = 4m
read_rnd_buffer_size = 2m
myisam_sort_buffer_size = 64m
tmp_table_size = 128m
query_cache_size =0
query_cache_type = 0
thread_cache_size = 8
max_connections = 400
wait_timeout = 300
  • To save press CTRL O
  • To exit press CTRL X
  • Type: service mysql restart 

4. Turned GZIP on in your .htaccess

  • SSH to your VPS
  • Go to your home directory e.g. cd /home/username/www
  • Type: nano .htaccess
  • This should open a file which is already full of information. You need to locate the lines below and make that section match what is below (UNCOMMENT lines by removing the # infront of them)

############################################
## enable resulting html compression


php_flag zlib.output_compression on 
Now the section for “mod_deflate.c” from your .htaccess file and uncomment the settings as follows:

Code: 

<IfModule mod_deflate.c>

############################################
## enable apache served files compression
## http://developer.yahoo.com/performance/rules.html#gzip

# Insert filter on all content
SetOutputFilter DEFLATE
# Insert filter on selected content types only
#AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript

# Netscape 4.x has some problems...
BrowserMatch ^Mozilla/4 gzip-only-text/html

# Netscape 4.06-4.08 have some more problems
BrowserMatch ^Mozilla/4\.0[678] no-gzip

# MSIE masquerades as Netscape, but it is fine
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html

# Don't compress images
SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary

# Make sure proxies don't deliver the wrong content
Header append Vary User-Agent env=!dont-vary  

</IfModule>

  • Once you are finished editing to save press: CTRL O
  • To quit press: CTRL X

5. Turned on Cache Management in Magento

  • Login to Magento Admin
  • Go to System -> Cache Management
  • Click 'Select All'
  • Then next to the word 'Actions' on the drop down box choose 'Enable'
  • Click 'Submit'

6. Turned on External Full Page Caching

  • Login to Magento Admin
  • Go to System -> Configuration
  • Scroll down on the left hand side click on Advanced -> System
  • Expand the section "External Full Page Cache Settings"
  • Select "Yes" to enable external cache
  • Leave the cookie lifetime at 3600 seconds
  • Set the External Cache Control to 'Zend Full Page Cache'
  • Click 'Save Config' on the top right of the screen
mysqld]
innodb_file_per_table=1
open_files_limit=5120
max_allowed_packet=128M
key_buffer = 512M
table_cache = 512
sort_buffer_size = 4m
read_buffer_size = 4m
read_rnd_buffer_size = 2m
myisam_sort_buffer_size = 64m
tmp_table_size = 128m
query_cache_size = 96m
query_cache_type = 1
thread_cache_size = 8
max_connections = 400
wait_timeout = 300
(167 vote(s))
Helpful
Not helpful