Skip to content

shivaas/hhvm-vagrant

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HHVM Vagrant box

Ubuntu Precise box simply installing HHVM (nightly) via apt.

Requirements

Installation

$ git clone https://github.com/vicb/hhvm-vagrant.git
$ cd hhvm-vagrant
$ vagrant up

Once the VM is booted you can log via SSH

$ vagrant ssh

The server root folder is /vagrant/www (on the map) which is the www folder on your host machine.

  • The HHVM server is available at http://localhost:8080 on the host OS
  • A MySQL server is installed. The root user is "root" with password "pa$$".

HHVM 3.0 Configuration

HHVM config files are in: /etc/hhvm/server.ini

To start hhvm: sudo service start hhvm. This will load the default config from server.ini

The access and error logs are available in /var/log/hhvm

$ vagrant ssh
$ tail -f /var/log/hhvm/access.log
$ tail -f /var/log/hhvm/error.log

WebServer

With HHVM 3.0, the inbuilt webserver support has been deprecated. HHVM should be used under fastcgi mode which is automatically configured in /etc/hhvm/server.ini

Installing Nginx

$ sudo apt-get install nginx

Setting up Nginx with HHVM If you installed Nginx after installing HHVM, it will automatically create a hhvm.conf file for you. You only need to create a site config for Nginx to load the config. This can be done by doing the following:

$ sudo vim /etc/nginx/sites-available/vagrant
//  File /etc/nginx/sites-available/vagrant
server {
    root /vagrant;
    index index.html index.htm index.php;

    server_name localhost; # 192.168.33.10.xip.io if you are using Vaprobash

    include hhvm.conf;  # Include HHVM's configuration file for Nginx

    location / {
        try_files $uri $uri/ /index.php?q=$uri&$args;
    }

    location ~ /\.ht {
        deny all;
    }
}
sudo ln -s /etc/nginx/sites-available/vagrant /etc/nginx/sites-enabled/vagrant

Edit hhvm.conf and update fastcgi_param to point to your document root path on the vagrant box.

  fastcgi_param  SCRIPT_FILENAME /vagrant/www$fastcgi_script_name;

Start Nginx

$ sudo service nginx start
$ curl http://localhost/index.php
    It Works!

Virtual Machine Management

When done just log out with ^D and suspend the virtual machine

$ vagrant suspend

then, resume to testing again

$ vagrant resume

Run

$ vagrant halt

to shutdown the virtual machine, and

$ vagrant up

to boot it again.

You can find out the state of a virtual machine anytime by invoking

$ vagrant status

Finally, to completely wipe the virtual machine from the disk destroying all its contents:

$ vagrant destroy

Credits

About

Ubuntu Precise box with HHVM nightly build.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 67.3%
  • C++ 32.5%
  • C 0.2%