In this tutorial , I am going to show you how to setup Nginx,HHVM,MySQL stack in Ubuntu Trusty ,
Nginx is light weight , open-source, high-performance HTTP server as all we know its great in serving static assets . HHVM is facebook’s open source
virtual machine use JIT to compile to run PHP and HACK .
HHVM is an open-source virtual machine designed for executing programs written in Hack and PHP. HHVM uses a just-in-time (JIT) compilation approach to achieve superior performance while maintaining the development flexibility that PHP provides.
HHVM
And MySQL is well known and most widely used open-source relational database management system
NOTE : All Steps demonstrated under virtual machine , I did not issue any guarantee that it will work for you , Please Leave your comments or use google to search for you problems
Okay , Lets install nginx first .
sudo apt-get update && sudo apt-get install nginx nginx-common nginx-core sudo service nginx start
now open browser and point url to IP address of your server . you will nginx welcome page
Okay Nginx is installed , lets install MySQL server
sudo apt-get update sudo apt-get install mysql-server mysql-client
after installation restart your terminal session ( reconnect if using ssh )
then run
mysql_secure_installation NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY! In order to log into MySQL to secure it, we'll need the current password for the root user. If you've just installed MySQL, and you haven't set the root password yet, the password will be blank, so you should just press enter here. Enter current password for root (enter for none): [ENTER YOUR PASSWORD ] Change the root password? [Y/n] [n]< <<---------------------- By default, a MySQL installation has an anonymous user, allowing anyone to log into MySQL without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into a production environment. Remove anonymous users? [Y/n] [Y]<<<---------------------- Disallow root login remotely? [Y/n] [Y] <<<---------------------- Remove test database and access to it? [Y/n] [Y] <<<---------------------- Reload privilege tables now? [Y/n] [Y] <<<---------------------- ... Success! Cleaning up... All done! If you've completed all of the above steps, your MySQL installation should now be secure. Thanks for using MySQL!
Now mysql is installed let’s install HHVM , Prebuilt package is aviable for ubuntu 14.04 so lets install
wget -O - http://dl.hhvm.com/conf/hhvm.gpg.key | sudo apt-key add - echo deb http://dl.hhvm.com/ubuntu trusty main | sudo tee /etc/apt/sources.list.d/hhvm.list sudo apt-get update sudo apt-get install hhvm
After Installation , HHVM installer provide you some info about how to setup FCGI etc.
Setup HHVM to start on boot
sudo update-rc.d hhvm defaults
setup hhvm FCGI
sudo /usr/share/hhvm/install_fastcgi.sh
you can setup all your runtime options in /etc/hhvm/config.hdf
file hhvm will load it automatically , see full runtime options available
https://github.com/facebook/hhvm/wiki/Runtime options
edit /etc/nginx/sites-available/default
and uncomment section ~ \.php$
In your configuration file include hhvm.conf
( this file is copied to /etc/nginx
directory by install_fastcgi.sh
script )
Now restart nginx and hhvm
sudo service nginx restart sudo service hhvm restart