mac 安装和配置 hhvm和nginx 总结

配置文件和文档见 https://github.com/robertzhai/php/tree/master/hhvm


1. 前端nginx讲请求转发给后端的以fastcgi模式运行的hhvm


2.hhvm install

brew tap hhvm

brew install hhvm

安装好后

$ hhvm --version
HipHop VM 3.14.3 (rel)
Compiler: 1470972790_N
Repo schema: 51c9cd8b577ded55390868fb9916ee95eb6175d8


3.nginx.conf
 server {
        listen       8098;
        server_name  localhost;
        root /wwwroot;
        index index.php  index.html index.htm main.php;
        location ~ \.php$ {
            fastcgi_pass   127.0.0.1:8099;
            #fastcgi_pass  unix:/usr/local/etc/hhvm/hhvm.sock;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
            include        fastcgi_params;
        }
    }


4.hhvm.hdf

ResourceLimit {
  CoreFileSize = 50000000000 # 设置core文件大小防止出core把磁盘写爆,in bytes, 设成0会导致不出core
  MaxSocket = 5000 # 最大句柄数,设为0会出core
  SocketDefaultTimeout = 5 # in seconds
  MaxRSS = 4000000000 # 最大占用的物理内存,如果超过,则进程退出
  MaxRSSPollingCycle = 60 # 检查内存占用的时间间隔
  DropCacheCycle = 0 # in seconds, how often to drop disk cache
}
Server {
    # 域名IP端口
        #Host = www.domain.com
    #IP = 0.0.0.0
        Type = fastcgi
        Port = 8099
        #FileSocket = /usr/local/etc/hhvm/hhvm.sock
}


Log {
  Level = Info
  AlwaysLogUnhandledExceptions = true
  RuntimeErrorReportingLevel = 8191
  UseLogFile = true
  UseSyslog = false
  File = /usr/local/etc/hhvm/error.log
  Access {
    * {
      File = /usr/local/etc/hhvm/access.log
      Format = %h %l %u % t \"%r\" %>s %b
    }
  }
}

5.启动hhvm daemon进程

hhvm --mode daemon --config ./hhvm.hdf

6.访问 

http://localhost:8098/index.php

HHVM Version 3.14.3


Version

Version 3.14.3
Version ID 31403
Debug  
Compiler ID 1470972790_N
Repo Schema 51c9cd8b577ded55390868fb9916ee95eb6175d8
PHP Version 5.6.99-hhvm
Zend Version 2.4.99
uname Darwin xxxMacBook-Pro-3.local 14.4.0 Darwin Kernel Version 14.4.0: Thu May 28 11:35:04 PDT 2015; xxx:xnu-2782.30.5~1/RELEASE_X86_64 x86_64


7.其它系统安装和配置请参考

https://www.deamwork.com/archives/toss-hhvmnginxfastcgi.orz6

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值