平台debian 7 x86_64
1,安装mysql源
wget http://dev.mysql.com/get/mysql-apt-config_0.6.0-1_all.deb
dpkg -i mysql-apt-config_0.6.0-1_all.deb
按需求选mysql6或7,apply
2,添加nginx源
echo "deb http://nginx.org/packages/debian/ wheezy nginx
deb-src http://nginx.org/packages/debian/ wheezy nginx" >> /etc/apt/sources.list
wget http://nginx.org/keys/nginx_signing.key
apt-key add nginx_signing.key
rm nginx_signing.key
3,更新系统并安装基本库
apt-get update
apt-get upgrade -y
apt-get install -y vim vim-runtime build-essential libpcre3 libpcre3-dev zlib1g zlib1g-dev openssl libssl-dev
4,安装nginx
apt-get install -y nginx
5,安装mysql
apt-get install -y mysql-server (输入root密码)
授权root账号有远程访问权限
mysql -u root -p
grant all privileges on *.* to root@'%' identified by "hello";
flush privileges;
exit
6,安装HHVM
debian 8源
echo "deb http://dl.hhvm.com/debian jessie-lts-3.12 main" >> /etc/apt/sources.list
debian7源(数字lts-*可以是3.3/3.6/3.9,现在最新的3.12版本)
echo "deb http://dl.hhvm.com/debian wheezy-lts-3.12 main" >> /etc/apt/sources.list
apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0x5a16e7281be7a449
apt-get update
apt-get install -y hhvm
hhvm默认是以9000端口tcp的方式提供fastcgi服务,当然你可以在/etc/hhvm/server.ini里
将hhvm.server.port =9000注释掉,然后添加
hhvm.server.file_socket = /var/run/hhvm/hhvm.sock.
然后在/etc/nginx/conf.d/default.conf里将fastcgi_pass 127.0.0.1:9000;注释掉,
加一行fastcgi_pass unix:/var/run/hhvm/hhvm.sock;
service hhvm restart
service nginx restart
7,建立网站目录并授权
mkdir -p /var/www/html
chown -R nginx:nginx /var/www/html
vi /etc/nginx/conf.d/default.conf
server {
listen 80;
server_name localhost;
root /var/www/html;
location / {
root /var/www/html;
index index.html index.php index.htm;
}
location ~ \.php$ {
# root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
8,测试
echo "<?php phpinfo(); ?>" > /var/www/html/index.php
service nginx restart
http://yourserverip/可看到hhvm的信息页基本就行了
转载于:https://my.oschina.net/u/2404183/blog/740592