How to Optimize EasyEngine for better performance?

Table:

  1. What is EasyEngine?
  2. EasyEngine vs ServerPilot?
  3. Best Practice for EasyEngine.
  4. How to fix SSL issues?
  5. How to fix Mysql Crash/Die issues on Low Ram VPS.
  6. EasyEngine PHP 7.1 and PHP 7.2

1. What is EasyEngine?

EasyEngine is a tool and complete solution to help you run websites under VPS environments. EasyEngine is combine of Nginx + PHP-FPM + Mysql.

EasyEngine also help you with many ssl, caching, and much more. I found it very easy to use and easy to customization.

best practice with EasyEngine

2. EasyEngine vs ServerPilot?

The big different in ServerPilot in server side settings is that ServerPilot still using Apache as proxy with Nginx.

EE use pure Nginx + PHP7 so it is much faster to handle multiple concurrent connections. In another words, EE can handle more traffics.

ServerPilot is not free any more so I am make a switching to EasyEngine and I love it.

Read more on how I optimize my site to load in less than 2 seconds with ServerPilot.

3. Best Practice for EasyEngine

My current configuration:

$ sudo ee site create wpspeedinsight.com --wpfc --letsencrypt

I will try with HHVM & Reddis and let you know.

Still updating…

4. How to fix EasyEngine SSL issues

EasyEngine using Nginx to serve the SSL and use Let’s Encrypt to generate the certificate. However, many people has complain with the page does not load and show error on Chrome and Firefox:

ERR_SPDY_PROTOCOL_ERROR

This issues is not http2 issues as many people seem to be able to fix by editing the nginx configuraton, example:

 $ cd /var/www/wpspeedinsight.com/conf/nginx/ $ vi ssl.conf 

And change from:

listen 443 ssl http2 

to

listen 443 ssl http

However, the REAL issues is use of “cipher” format. Since PCI compliance doesn’t need this algorithm, we can safely disable it by explicitly defining ssl_ciphers. Let’s change the nginx default configuration file:

 $ sudo vi /etc/nginx/nginx.conf 

and change the default ssl_ciphers from:

 ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM 

to:

 ssl_ciphers HIGH:!aNULL:!MD5:!kEDH; 

Now, restart nginx and your ssl problem is fixed.:

 $ sudo ee stack restart 

5. How to fix Mysql Crash/Die issues on Low Ram VPS.

After running EasyEngine on my Vultr for a while, I noticed mysql crash and die every few hours, this doesn’t happen to ServicePilot at all and I was wondering what is the reason.

So the two main reason:

  • Mysql using too much RAM on low end VPS.
  • Reduce RAM usage for Nginx.
  • Low Swap Memory

Let’s take step by step to fix this:

  • Optimize Mysql with mysqltuner.
  • Follow this guide to add swap memory on your VPS:

https://www.digitalocean.com/community/tutorials/how-to-add-swap-on-ubuntu-14-04

  • Reduce RAM usage for Nginx: on low RAM VPS, for high traffic PHP5-FPM takes nearly all RAM, leaving no RAM to MySQL

Reduce the PHP5-FPM pm.max_children, depend on which PHP version you are using, in my case was PHP7.0

sudo vi /etc/php/7.0/fpm/php-fpm.conf

Change default pm.max_children to 12:

pm.max_children = 10

Restart the server and you are all set. Mysql has been running for weeks now and doesn’t detect any issues.

6. EasyEngine PHP 7.1 and PHP 7.2

I was developing PHP application with Laravel and Laravel require PHP 7.1.3 at the current date of writing.

So I need to add PHP 7.1 and PHP 7.2 to the server.

First, let’s install PHP 7.1:

 $ sudo apt-get install software-properties-common $ sudo add-apt-repository ppa:ondrej/php $ sudo apt-get update $ sudo apt-get install php7.1 php7.1-cli php7.1-common php7.1-json php7.1-mbstring php7.1-mcrypt php7.1-zip php7.1-fpm 

Now, lets add PHP7.1 to EasyEngine, first copy the PHP FPM configuration from PHP7.0:

 $ sudo cp -f /etc/php/7.0/fpm/pool.d/www.conf /etc/php/7.1/fpm/pool.d/www.conf 

Change the listening port of php7.1-fpm (for example 7080 )

 $ sudo vi /etc/php/7.1/fpm/pool.d/www.conf 

Replace the line listen = 127.0.0.1:9070 by listen = 127.0.0.1:9080

Now Add php7.1-fpm as an additional php version

Add the following lines in /etc/nginx/conf.d/upstream.conf

 upstream php71 { server 127.0.0.1:9080; } 
then copy the files /etc/nginx/common/php7.conf into /etc/nginx/common/php71.conf

And into this copy replace the line fastcgi_pass php7; by fastcgi_pass php71;

Reload nginx and you can replace the line include common/php7.conf; by include common/php71.conf; in the vhosts for which domain you want to serve as PHP7.1 of your choice.

 

2018-08-16T05:28:45+00:00

Leave A Comment

WordPress Video Lightbox Plugin