debian 7+nginx+hhvm+mysql

平臺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的信息頁基本就好了
 php

相關文章
相關標籤/搜索