码迷,mamicode.com
首页 > 数据库 > 详细

centos6 配置hhvm+php+Nginx+mysql

时间:2014-11-17 17:16:17      阅读:556      评论:0      收藏:0      [点我收藏+]

标签:blog   http   io   ar   os   sp   div   on   2014   

HHVM(HipHop Virtual Machine),Facebook的开源项目之一,用于代替php环境,这里不多做介绍,本文介绍配置教程.

安装所需的epel和hhvm yum源

rpm -Uvh http://mirrors.ustc.edu.cn/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm

安装hhvm所需依赖包

sudo yum install libmcrypt-devel glog-devel jemalloc-devel tbb-devel libdwarf-devel mysql-devel libxml2-devel libicu-devel pcre-devel gd-devel boost-devel sqlite-devel pam-devel bzip2-devel oniguruma-devel openldap-devel readline-devel libc-client-devel libcap-devel libevent-devel libcurl-devel libmemcached-devel

添加gleez yum源

sudo rpm -Uvh http://yum.gleez.com/6/x86_64/gleez-repo-6-0.el6.noarch.rpm

如果是国内主机,由于gleez.com被墙,这里提供另外一个下载地址

sudo rpm -Uvh http://blog.linuxeye.com/wp-content/uploads/2014/05/gleez-repo-6-0.el6.noarch.rpm

安装remi yum源

sudo rpm -Uvh http://rpms.famillecollet.com/enterprise/6/remi/x86_64/remi-release-6.5-1.el6.remi.noarch.rpm

从remi安装hhvm依赖包 , mysql

yum --enablerepo=remi install libwebp mysql mysql-devel mysql-lib

安装hhvm

yum --nogpgcheck install hhvm

将hhvm加入开机启动

chkconfig hhvm on

配置hhvm

# vi /etc/hhvm/server.ini

;hhvm.server.port = 9001 (注释或者删除此行)
hhvm.server.file_socket = /var/run/hhvm/sock (添加此行,hhvm运行模式由端口改为socket方式)

# vi /etc/hhvm/php.ini在php options下面追加为以下内容,以添加内存限制,关闭expose.

hhvm.mysql.socket =/tmp/mysql.sock
memory_limit = 512M
expose_php = 0

配置nginx:

找到service字段内的php部份,此处在每次添加完虚拟主机以后都要修改.

fastcgi_pass unix:/tmp/php-cgi.sock; (注释此行)
fastcgi_pass unix:/var/run/hhvm/sock; (添加此行)

如:

location ~ \.php{
  root  /usr/share/nginx/html;
  fastcgi_pass unix:/var/run/hhvm/sock;
  fastcgi_split_path_info ^(.+\.php)(.*)$;
  fastcgi_index  index.php;
  fastcgi_param PATH_INFO $fastcgi_path_info;

  fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
  fastcgi_param  PATH_TRANSLATED $document_root$fastcgi_path_info;
  include	fastcgi_params;
    }

重启nginx,启动hhvm.大功告成.

service nginx restart
service hhvm start
service mysqld start
 

centos6 配置hhvm+php+Nginx+mysql

标签:blog   http   io   ar   os   sp   div   on   2014   

原文地址:http://www.cnblogs.com/dxm2025/p/4103738.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!