您的位置:首页 > 运维架构 > Nginx

mac 安装和配置 hhvm和nginx 总结

2016-09-09 07:23 387 查看
配置文件和文档见 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

Version3.14.3
Version ID31403
Debug 
Compiler ID1470972790_N
Repo Schema51c9cd8b577ded55390868fb9916ee95eb6175d8
PHP Version5.6.99-hhvm
Zend Version2.4.99
unameDarwin 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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: