Note: If you use non-root permissions, add sudo before the command;
# Update and upgrade
Apt-get update & apt-get upgrade
# Install Nginx
Apt-get install nginx-y
# Install Mysql
Apt-get install mysql-server-5.6-y
# Installing HHVM
Apt-get install hhvm-y
# Install PhpMyAdmin
Apt-get install phpmyadmin-y
# Install process daemon
Apt-get install ps-watcher-y
# Install FastCGI configuration script
/Usr/share/hhvm/install_fastcgi.sh
# Automatically configure phpmyadmin
/Usr/sbin/pma-configure.
/Usr/sbin/pma-secure
# Access through: Domain name/phpmyadmin
Ln-s/usr/share/phpmyadmin/usr/share/nginx/html
# Add hhvm to startup
Update-rc.d hhvm defaults
# Edit and add or replace hhvm. conf
Nano/etc/nginx/hhvm. conf
Location ~ \. (Hh | php) $ {
Fastcgi_keep_conn on;
# Fastcgi_pass 127.0.0.1: 9000;
Fastcgi_pass unix:/var/run/hhvm/sock;
Fastcgi_index index. php;
Fastcgi_param SCRIPT_FILENAME $ document_root $ fastcgi_script_name;
Include fastcgi_params;
}
# Edit and add or replace php. ini
Nano/etc/hhvm/php. ini
; Php options
Session. save_handler = files
Session. save_path =/var/lib/php5
Session. Gc_maxlife time = 1440
; Hhvm specific
Hhvm. log. level = Warning
Hhvm. log. always_log_unhandled_exceptions = true
Hhvm. log. runtime_error_reporting_level = 8191
Hhvm. mysql. typed_results = false
Hhvm. enable_zend_compat = true
Max_execution_time= 300
Max_input_time = 60
Post_max_size = 10 M
Upload_max_filesize = 10 M
Memory_limit = 512 M
Expose_php = 0
# Edit and add or replace server. ini
Nano/etc/hhvm/server. ini
; Php options
Pid =/var/run/hhvm/pid
; Hhvm specific
; Hhvm. server. port = 9000
Hhvm. server. file_socket =/var/run/hhvm/sock
Hhvm. server. type = fastcgi
Hhvm. server. default_document = index. php
Hhvm. log. use_log_file = true
Hhvm. log. file =/var/log/hhvm/error. log
Hhvm. repo. central. path =/var/run/hhvm. hhbc
# Edit add or replace ps-watcher.conf
Nano/etc/ps-watcher.conf
[Hhvm]
Occurs = none
Action = service hhvm restart
# Enable ps-watcher
Sed-I-e's/# startup = 1/startup = 1/g'/etc/default/ps-watcher
# Edit and add or replace hhvm
Nano/etc/init. d/hhvm
RUN_AS_USER = "www"
RUN_AS_GROUP = "www"
# Edit and add or replace nginx. conf
Nano/etc/nginx. conf
User www;
Worker_processes auto;
# Add www users and user groups
Groupadd www;
Useradd-m-s/sbin/nologin-g www;
# Change the owner to www
Chown-R www. www/var/log/nginx
Chown-R www. www/var/run/hhvm
Chown-R www. www/var/log/hhvm
Chown-R www. www/var/lib/phpmyadmin
Chown-R www. www/usr/share/phpmyadmin
Chown-R www. www/etc/phpmyadmin/
# Deleting a user
Userdel-r nginx
Userdel-r www-data
# Start
Service nginx restart
Service mysql restart
Service hhvm restart
Service ps-watcher restart