Just for a reminder, here are steps as a note to let anyone who wanna install HHVM + Nginx + MySQL on Google Cloud Platform (a.k.a GCP) like me.
So, here we go.
Before installation, we should shut down apache server, and then start installing Nginx server.
$sudo service apache2 stop
Start installing Nginx, and add it to boot automatically, and start it.
$sudo apt-get install nginx $sudo update-rc.d nginx defaults $sudo service nginx start
Start installing HHVM. HHVM is a virtual machine created by Facebook engineers. It is designed for high traffic request when you are using PHP as a server language. The biggest difference between HHVM PHP and other PHP servers is that HHVM compiles PHP code into machine code, that would make it faster for processing. You can refer the [HHVM] section in reference. I survey some other references, when you use HHVM, you will need more RAM and CPU for it. But I think that makes sense, cause it compiles PHP into machine code to get a better performance. Just like Android ART, it compiles Android APK into dex for machine code when you install your app, but the benefit is: it’s faster.
Add GnuPG public keys first.
$sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0x5a16e7281be7a449
Add repo to source list. if you can’t run add-apt-repository, refer here.
$sudo add-apt-repository "deb http://dl.hhvm.com/ubuntu $(lsb_release -sc) main"
Update repo, install HHVM, and add it to boot automatically.
$sudo apt-get update $sudo apt-get install hhvm $sudo update-rc.d hhvm defaults
Now, cause you just installed Nginx server and HHVM, we need to use default HHVM configuration script to config HHVM into Nginx.
$sudo sh /usr/share/hhvm/install_fastcgi.sh
If you are curious what it does when you run the script, you can check the script code. Basically, it integrates the HHVM.conf into Nginx server default setting file. So, I will recommend you use a clean environment to install HHVM and Ngnix.
Install MySQL, MySQL server will bind to localhost (127.0.0.1)
$sudo apt-get install mysql-server
After installation, I will strongly recommend that you should harden your MySQL server by using “mysql_secure_installation” script.
When you finish all installation, you should be able to log in your MySQL.
$sudo mysql -u root -p
[Install Ngnix & HHVM]