Previously, averages about 1,900ms in response time according to Pingdom Public Status Page. When I switched over to HTTPS, the response time increased to 2,600ms. I was still on Apache 2.4.7 running PHP 5.5.9 via mod_php.

When I made the switch to nginx 1.6.2 running PHP 5.5.22 via php-fpm, the response time decreases back to 1,900ms. Response Times Response Times

As you can see Apache/mod_php with HTTP performs roughly the same with nginx/php-fpm with HTTPS.

nginx   PHP

Ubuntu 14.04 comes with nginx 1.4.6 and PHP 5.5.9 which is pretty dated. nginx 1.4.6 was released on 4th March 2014 and PHP 5.5.9 was released on 5th February 2014.

The latest stable version of nginx is 1.6.2 which was released on 16th September 2014 and PHP is 5.5.22 which was release on 19th February 2015.

To use the latest version of nginx and PHP, you need to use Personal Package Archives (PPA) hosted on Launchpad.

Here is how you can upgrade your nginx and PHP. I used the same commands on my Ubuntu 14.04.

$ apt-get install software-properties-common
$ add-apt-repository ppa:nginx/stable
$ add-apt-repository ppa:ondrej/php5
$ apt-get update
$ apt-get upgrade
$ apt-get install php5 nginx

After upgrading nginx and PHP5, you thought it will work? But unfortunately that is not the case.

nginx serves static pages fine but not PHP pages. In the nginx error logs:

connect() to unix:/var/run/php5-fpm.sock failed (2: No such file or directory) while connecting to upstream, server:, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: ""

connect() to unix:/var/run/php5-fpm.sock failed (13: Permission denied) while connecting to upstream, server:, request: "HEAD / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: ""

As you can see, nginx has problem accessing the php5-fpm.sock. I did a lot of Googling, changed a lot of permissions but none of the methods work.

I chanced upon this article Configuring and Optimizing PHP-FPM and Nginx on Ubuntu (or Debian!) and in the comment by miklb, he said he needed to add fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; to /etc/nginx/fastcgi_params.

Since I am desperate and running out of time, I decided to give that config a try, and to my surprise, that actually fixes the problem of the php5-fpm.sock!

Just to clarify that my nginx is running as user www-data and in my /etc/php5/fpm/pool.d/www.conf, all the user/owner/group is www-data
user = www-data
group = www-data
listen.owner = www-data = www-data
;listen.mode = 0660



Ubuntu 14.04 comes with MySQL 5.5.9 out of the box and I decided to give MariaDB a try after attending a talk by Michael “Monty” Widenius. He is the creator of MariaDB, and the original author & architect of the MySQL server. His talk was pretty inspirational for me. Anyway MariaDB is an enhanced, drop-in replacement for MySQL and yes, it even works with mysqldump. According to Monty, you should get a performance boost by just switching from MySQL 5.5 to MariaDB 10.0.

I am in Singapore and hence I choose the DigitalOcean Singapore repository for MariaDB for my Ubuntu 14.04.

The below commands will upgrade your MySQL to MariaDB on Ubuntu. Despite the upgrade process is flawless for me, do backup your databases first just in case anything happens.

$ apt-get install software-properties-common
$ apt-key adv --recv-keys --keyserver hkp:// 0xcbcb082a1bb943db
$ add-apt-repository 'deb trusty main'
$ apt-get update
$ apt-get remove --purge mysql-server mysql-client mysql-common
$ apt-get autoremove
$ apt-get autoclean
$ apt-get install mariadb-server

As of writing, the latest stable version of MariaDB is 10.0.17.

I am on the left with the cardboard version of Serguei Beloussov (CEO of Acronis) in the middle and on the right is Michael “Monty” Widenius.