HHVMApache 2.4 Nginx Build Station environment construction method installation run WordPress blog VPS Host June 02, 2014 17:20 Comments»
Article Directory
- Install on Debian
- Installing on CentOS
- Install on Ubuntu
- Install WordPress
- HHVM Installation Summary
HHVM is a powerful built-in environment that can be used in place of PHP, from the Facebook team, which is a PHP JIT (just-in-time) compiler with the advantage of generating fast code and instant compilation. It is proved by practice that HHVM can significantly improve PHP execution speed and save a lot of server resources.
HHVM Separate installation is relatively simple, the official also for a variety of operating systems to launch a detailed documentation, generally follow the instructions of the document can be installed successfully,HHVM is mainly used to replace PHP, the usual LNMP namely Linux, Nginx, MysqL, PHP architecture is replaced with LNMH (H is HHVM).
This article will share the Debian7 x64, CentOS 6.5 (64-bit), Ubuntu 12.04 built HHvmApache 2.4 Nginx Station environment, while installing and running the WordPress blog program, HHVM 's powerful performance-boosting capabilities maximize the efficiency of WordPress operations and save server costs.
For the server to optimize the speed and the site cluster interested friends, can come to see:
- 1, Memory Acceleration: Use varnish and memcached cache to the WordPress website speed up-memory-level acceleration
- 2. Foreground cache: Use Redis cache to accelerate WordPress site-for Apache and Nginx
- 3. Load balancing: Free space + cheap VPS and Openresty,ngx_lua,redis build system load Balancing environment
HHVM Apache 2.4 Nginx Build Station environment construction method installation Run WordPress blog
First, Debian installation HHVM, nginx build LNMH environment
1, in the Debian 7 64-bit Linux installation HHVM, Nginx, MysqL, and build LHMH station environment, you can refer to this article:HHVM installation using the tutorial-efficient PHP operating environment to improve PHP performance of more than 9 times times.
Second, install HHVM, Apache 2.4 on CentOS
1, in fact, Apache 2.2 can also be used with HHVM , but Apache 2.2 because no mod_proxy_fcgi also need to install libapache2-mod-fastcgi, configuration is more troublesome. Installing Apache 2.4 can be combined directly with HHVM . Moreover, Apache 2.4 has a great performance boost, supports more traffic, better support for cloud meters, more concurrency with less memory, and more.
2, install HHVM, Apache 2.4 on CentOS, execute the following command:
cd /etc/yum.repos.d
sudo wget http://repos.fedorapeople.org/repos/jkaluza/httpd24/epel-httpd24.repo
sudo wget http://www.hop5.in/yum/el6/hop5.repo
sudo yum install httpd24-httpd httpd24-httpd-devel httpd24-mod_ssl
sudo yum install hhvm
3. Configure Apache 2.4 To enable HHVM. Go to configuration directory: cd/opt/rh/httpd24/root/etc/httpd/conf, edit: Vim httpd.conf, at the end of this sentence do not be annotated: includeoptional conf.d/*.conf
4, then enter the configuration directory: CD/OPT/RH/HTTPD24/ROOT/ETC/HTTPD/CONF.D, edit the configuration file: Vim httpd24-vhosts.conf (no words directly new), add the following code, save.
<virtualhost *:80>
ServerName hhvmtest.dev
DocumentRoot /var/www/html/hhvmtest
ErrorLog logs/hhvmtest.dev-error_log
CustomLog logs/hhvmtest.dev-access_log common
# where HHVM is running
# use either Proxy Pass or ProxyPassMatch
# ProxyPass routes all traffic to FastCGI
ProxyPass / fcgi://127.0.0.1:9000/var/www/html/hhvmtest
# ProxyPassMatch regular expression routes only PHP files
ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9000/var/www/html/hhvmtest/$1
<directory hhvmtest html www var> # relaxed permissions for testing
AllowOverride all
Options -MultiViews
Require all granted
</directory>
</virtualhost>
5. Execute command to open HHVM:/usr/bin/HHvm --mode server-vserver.port=9000-vserver.type=fastcgi &
6. Execute command: PS aux | grep HHVM, you can see that HHVM is already running. (Click to enlarge)
7. Start Apache command: sudo service httpd24-httpd start
8. In the root directory: cd/opt/rh/httpd24/root/var/www/html, create a new file directory: mkdir hhvmtest. This hhvmtest is the root directory of the website. At this point CentOS installs HHVM, Apache 2.4 complete,
Third, install HHVM, Nginx, MysqL on Ubuntu
1, Ubuntu installed HHvm, Nginx, laravel process is also relatively simple, the first is to install Nginx, execution:
sudo apt-get update
sudo apt-get install -y unzip vim git-core curl wget build-essential python-software-properties
sudo add-apt-repository -y ppa:nginx/stable
sudo apt-get update
sudo apt-get install -y nginx
2, followed by the installation of HHVM .
#Ubuntu 12.04:
sudo add-apt-repository -y ppa:mapnik/boost
wget -O - http://dl.hhvm.com/conf/hhvm.gpg.key | sudo apt-key add -
echo deb http://dl.hhvm.com/ubuntu precise main | sudo tee /etc/apt/sources.list.d/hhvm.list
sudo apt-get update
sudo apt-get install -y hhvm #Ubuntu 14.04:
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 -y hhvm
3, installed HHVM will prompt as follows: (click to enlarge)
4. The script for fastcgi configuration is given here, execute the following command:
sudo /usr/share/hhvm/install_fastcgi.sh
sudo /etc/init.d/nginx restart #Restart Nginx
sudo update-rc.d hhvm defaults #boot
sudo service hhvm restart #Restart hhvm
5. If you want to use HHVMas a PHP command, execute: sudo/usr/bin/update-alternatives--install/usr/bin/php php/usr/bin/HHVM 60, so you can use: php-v such a command.
6,HHVM configuration file is placed in/etc/nginx/HHVM. conf, open the configuration file, you can see that Nginx has been configured to complete.
7, but in the/etc/nginx/sites-available/default can also see the nginx contains the HHVM. conf configuration file.
8, the root directory of the site is in/usr/share/nginx/html, you can upload PHP files to this directory, view Phpinfo () can see is hiphop.
9. Install MySQL database. Execute a command: Apt-get install Mysql-server, you will be asked to set the MySQL database password during the installation process.
10. Then add MySQL to boot, command: Chkconfig add mysqld and Chkconfig MySQL on
11, if prompted to say:/sbin/insserv:no such file or directory, execute: Ln-s/usr/lib/insserv/insserv/sbin/insserv, and then execute: chkconfig-- Levels 235 MySQL on
12, execution: Chkconfig--list, you can see all boot start items, there are three on the above is the boot project. Restart Mysql:service mysqld Start (click to enlarge)
13, log in s-s-h mysql command: Mysql-u root-p, and then enter the password. New FREEHAO123WP databases: Create DATABASE freehao123wp; , create username and password: "Create user [email protected] ' localhost ' identified by ' 123456789 '; 。
14. Grant a partial read and write permission to the freehao123wp.* to [email protected] ' localhost '; , grant all permissions to the user: Grant Select on freehao123wp.* to [email protected] ' localhost '; 。 show databases; is to view the database (note: Each command is followed by a ";" End).
15. If you are modifying the MySQL user name and password, execute the following command:
use mysql;
update user set password = PASSWORD (‘new password’) where user = ‘user name’;
flush privileges;
Iv. installing HHvm, Nginx, MariaDB, Wordpress, PhpMyAdmin on Ubuntu
1, Ubuntu with Ubuntu 12.04, first to install MARIADB. Reference: Rosehosting. (Note: mariadb is a MySQL branch, fully compatible with MySQL, but there are a number of improvements, performance improvements, the new version of the LNMP also increased mariadb)
apt-get update && apt-get upgrade
apt-get install python-software-properties curl
apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xcbcb082a1bb943db
add-apt-repository ‘deb http://ftp.osuosl.org/pub/mariadb/repo/5.5/ubuntu precise main‘
apt-get update
echo -e "Package: *\nPin: origin ftp.osuosl.org\nPin-Priority: 1000" | tee /etc/apt/preferences.d/mariadb
apt-get install mariadb-server
2, execute the following command to create the database, database user name, the same way.
mysql -uroot -p
CREATE DATABASE wpdb;
GRANT ALL PRIVILEGES ON wpdb.* TO ‘freehao123‘@‘localhost‘ IDENTIFIED BY ‘123456789‘;
FLUSH PRIVILEGES;
\q
3, install Nginx 1.4.x.
add-apt-repository ppa:nginx/stableapt-get install nginx
4, if the VPS has multi-core CPU, can be configured in nginx.conf to maximize the use of many threads, improve performance. Execute the following command:
sed -i "0,/^worker_processes/ s/^worker_processes .*$/worker_processes `grep -c processor /proc/cpuinfo`;/" /etc/nginx/nginx.conf
5. Install HHVM and hhvm-fastcgi. Execute the following command:
apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 5A16E7281BE7A449
echo deb http://dl.hhvm.com/ubuntu precise main | tee /etc/apt/sources.list.d/hhvm.list
apt-get update
apt-get install hhvm-fastcgi
6, after the installation is complete, will be prompted as follows:
********************************************************************
* HHVM is installed. Here are some more things you might want to do:
*
* Configure your webserver to use HHVM:
* $ sudo /usr/share/hhvm/install_fastcgi.sh
* $ sudo /etc/init.d/nginx restart
* $ sudo /etc/init.d/apache restart
* $ sudo /etc/init.d/hhvm restart
*
* Start HHVM at boot:
* $ sudo update-rc.d hhvm defaults
*
* Run command line scripts with HHVM:
* $ hhvm whatever.php
*
* Use HHVM for /usr/bin/php even if you have php-cli installed:
* $ sudo /usr/bin/update-alternatives --install /usr/bin/php php /usr/bin/hhvm 60
********************************************************************
7, if you imagine using PHP as the use of HHVM, do: Ln-s $ (which HHVM)/usr/local/bin/php
8, for the domain name Freehao123.info in the WWW root directory to create a Web site root directory and log storage directory. Download WordPress at the same time to put it in this directory.
mkdir -p /var/www/freehao123.info/{public_html,logs}
wget -q -O - http://wordpress.org/latest.tar.gz | tar -xzf - --strip 1 -C /var/www/freehao123.info/public_html
chown www-data: -R /var/www/freehao123.info/public_html
9, the above download is the latest version of WordPress, English (Do not worry, the installation of WordPress can be directly to the background set to Chinese), we can also go to the WordPress Chinese website Download the Chinese language pack WordPress.
10, add the virtual host in Nginx. Execute: Cat << ' EOF ' >/etc/nginx/sites-available/freehao123.info, place the following command inside (note: Replace with your own domain name and path):
server {
server_name hhvm.freehao123.info;
listen 80;
root /var/www/freehao123.info/public_html;
access_log /var/www/freehao123.info/logs/access.log;
error_log /var/www/freehao123.info/logs/error.log;
index index.php;
location / {
try_files $uri $uri/ /index.php?q=$uri&$args;
}
location ~* \.(jpg|jpeg|gif|css|png|js|ico|html)$ {
access_log off;
expires max;
}
location ~ /\.ht {
deny all;
}
location ~ \.php$ {
fastcgi_index index.php;
fastcgi_keep_conn on;
include /etc/nginx/fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
11, last input: EOF save exit. Then execute the following command:
ln -s /etc/nginx/sites-available/freehao123.info /etc/nginx/sites-enabled/freehao123.info/etc/init.d/nginx restart
12, the Nginx,hhvm, MySQL set to boot, execute the command:
update-rc.d nginx defaults
update-rc.d hhvm defaults
update-rc.d mysql defaults
13, HHVM installation run WordPress. DNS resolution of your domain name to HHvm This server (just add nginx configuration added domain name), open the domain name will go to the WordPress installation page, Do not jump to the WordPress installation page before checking that your WordPress is not placed in the root directory of the domain name.
14,HHVM run WordPress without any problems, plug-in installation, theme upgrades, permissions, fixed links and so on are OK.
15, install phpMyAdmin to manage MySQL. The pursuit of minimalist friends or like to manage MySQL database in s-s-h, but many people still like to use phpMyAdmin to manage MySQL.
16. Enter your Web accessible directory, create a new directory to store the phpMyAdmin, and then download and decompress directly
wget http://jaist.dl.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.2.2/phpMyAdmin-4.2.2-all-languages.zipunzip phpMyAdmin-4.2.2-all-languages.zip
17, after the decompression of the phpMyAdmin established to rename the directory for easy access. Create a new folder with the command: mkdir config, setting writable: chmod o+rw Config
18. Then open the installation page, similar to:/HTTPhhvm. freehao123.info/db/phpmyadmin/setup/, create a new server.
19, here can be the server port, name, SSL, connection mode, etc. to set. (Click to enlarge)
20, the authentication method generally chooses the cookie.
21, phpMyAdmin installation also provides advanced features, there is a need to adjust the MySQL friends can be set directly here. (Click to enlarge)
22, so the settings are good after clicking on the application. Then go back to the phpMyAdmin installation page, select the profile you just created in the profile, click Save, and the MySQL server configuration is complete.
23, then the Config folder generated config.inc.php moved to the phpMyAdmin root directory, while deleting the entire config folder, the config.inc.php set to all non-writable: chmod O-RW config.inc.php
24, now open the phpMyAdmin access page, you will see the login page. Enter your root account and password
25. Once the login is complete, you can start managing SQL online.
Five, HHvm Apache 2.4 nginx run WordPress Blog Summary
1,HHVM can completely replace PHP to run WordPress, in view of WordPress in the processing of large database and high traffic pressure performance unsatisfactory, use HHVM to run WordPress is a good choice.
2,HHVM and Nginx is the best partner, Nginx and Apache in many aspects also need to improve, installed MySQL database can be directly used to manage the command, of course, WordPress comes with a database management plug-in enough.
Article from: Free Resources tribe http://www.freehao123.com/All rights reserved. This site, in addition to the source, are the author of original articles, can be freely quoted, but please specify the source.
HHVM Apache 2.4 Installation and construction of the site environment WordPress blog