ini HHVM 3.0上的Nginx配置示例

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ini HHVM 3.0上的Nginx配置示例相关的知识,希望对你有一定的参考价值。

## here is phpmyadmin nginx

## environment
## OS: ubuntu 12.04
## Nginx: 1.4.7
## hhvm 3.0
## phpMyAdmin: 4.1.12


## locale: /etc/nginx/sites-available/phpmyadmin
server {
        listen 80;
        server_name /*yourdomain*/;

        location / {
                        root /var/www/phpmyadmin/;
                        index index.php;
        }

        location ~ \.php$ {
                root /var/www/phpmyadmin/;
                include        hhvm.conf;
        }
}


## *then execute command below
## sudo ln -s /etc/nginx/sites-available/phpmyadmin /etc/sites-enabled/phpmyadmin

apache_conf Codeigniter通过HHVM和FastCGI在Centos 6.4上运行

# Endpoint Apache Config
Listen 80
ServerName site.com

# Options for all directories
<Directory />
        Options FollowSymLinks
        AllowOverride All
</Directory>


<VirtualHost *:80>

        DocumentRoot /var/www/html


        # Hack configuration
        <FilesMatch \.php$>
                SetHandler hhvm-php-extension
        </FilesMatch>
        <FilesMatch \.hh$>
                SetHandler hhvm-hack-extension
        </FilesMatch>

        # Load fastCGI for HHVM backend connectivity
        #LoadModule fastcgi_module modules/mod_fastcgi.so
        #Action hhvm-php-extension / virtual
        Action hhvm-php-extension /hhvm virtual
        Action hhvm-hack-extension /hhvm virtual

        Alias /hhvm hhvm
        FastCgiExternalServer hhvm -host 127.0.0.1:9000 -pass-header Authorization -idle-timeout 300
</VirtualHost>
#!/bin/bash
yum install http://ftp.riken.jp/Linux/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm -y
cd /etc/yum.repos.d
wget "http://www.hop5.in/yum/el6/hop5.repo"
yum install hhvm mod_fastcgi fcgi-devel httpd -y

echo "##########################################"
echo "1) Uncomment NameVirtualHost *:80 in /etc/httpd/conf/httpd.conf"
echo "2) Install all configuration files included with this gist:"
echo "3) hhvm -> /etc/init.d/hhvm"
echo "4) config.hdf -> /etc/hhvm/config.hdf"
echo "5) fastcgi.conf -> /etc/httpd/conf.d/fastcgi.conf"
echo "6) site.conf -> /etc/httpd/conf.d/site.conf"
#!/bin/bash
# Run this after installing configs:
chkconfig --add hhvm
chkconfig hhvm on
/etc/init.d/httpd restart
#!/bin/bash
# HHVM daemon
# chkconfig: 345 20 80
# description: HHVM daemon for fcgi connections
# processname: hhvm

DAEMON_PATH="/var/www/html"

DAEMON=hhvm
DAEMONOPTS="--mode server --user apache"

NAME=HHVM
DESC="HHVM for FastCGI"
PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME

case "$1" in
start)
        printf "%-50s" "Starting $NAME..."
        cd $DAEMON_PATH
        PID=`$DAEMON $DAEMONOPTS > /dev/null 2>&1 & echo $!`
        #echo "Saving PID" $PID " to " $PIDFILE
        if [ -z $PID ]; then
            printf "%s\n" "Fail"
        else
            echo $PID > $PIDFILE
            printf "%s\n" "Ok"
        fi
;;
status)
        printf "%-50s" "Checking $NAME..."
        if [ -f $PIDFILE ]; then
            PID=`cat $PIDFILE`
            if [ -z "`ps axf | grep ${PID} | grep -v grep`" ]; then
                printf "%s\n" "Process dead but pidfile exists"
            else
                echo "Running"
            fi
        else
            printf "%s\n" "Service not running"
        fi
;;
stop)
        printf "%-50s" "Stopping $NAME"
            PID=`cat $PIDFILE`
            cd $DAEMON_PATH
        if [ -f $PIDFILE ]; then
            kill -HUP $PID
            printf "%s\n" "Ok"
            rm -f $PIDFILE
        else
            printf "%s\n" "pidfile not found"
        fi
;;

restart)
        $0 stop
        $0 start
;;

*)
        echo "Usage: $0 {status|start|stop|restart}"
        exit 1
esac
# WARNING: this is a kludge:
## The User/Group for httpd need to be set before we can load mod_fastcgi,
## but /etc/httpd/conf.d/fastcgi.conf on RHEL gets loaded before
## /etc/httpd/conf/httpd.conf, so we need to set them here :(
## mod_fcgid does not have this bug,
## but it does not handle child PHP processes appropriately per
## http://serverfault.com/questions/303535/a-single-php-fastcgi-process-blocks-all-other-php-requests/305093#305093

User apache
Group apache

LoadModule fastcgi_module modules/mod_fastcgi.so

# dir for IPC socket files
FastCgiIpcDir /var/run/mod_fastcgi

# wrap all fastcgi script calls in suexec
FastCgiWrapper Off

# global FastCgiConfig can be overridden by FastCgiServer options in vhost config
FastCgiConfig -idle-timeout 20 -maxClassProcesses 1

# sample PHP config
# see /usr/share/doc/mod_fastcgi-2.4.6 for php-wrapper script
# don't forget to disable mod_php in /etc/httpd/conf.d/php.conf!
#
# to enable privilege separation, add a "SuexecUserGroup" directive
# and chown the php-wrapper script and parent directory accordingly
# see also http://www.brandonturner.net/blog/2009/07/fastcgi_with_php_opcode_cache/
#
#FastCgiServer /var/www/cgi-bin/php-wrapper
#AddHandler php-fastcgi .php
#Action php-fastcgi /cgi-bin/php-wrapper
#AddType application/x-httpd-php .php
#DirectoryIndex index.php
#
#<Location /cgi-bin/php-wrapper>
#    Order Deny,Allow
#    Deny from All
#    Allow from env=REDIRECT_STATUS
#    Options ExecCGI
#    SetHandler fastcgi-script
#</Location>
Server {
   Type=fastcgi
   Port=9000
   PathDebug = true
   FixPathInfo = true
}

VirtualHost {
  * {
    Pattern = .*
    }
}

StaticFile {
  FilesMatch {
    * {
      pattern = .*\.(dll|exe)
      headers {
        * = Content-Disposition: attachment
      }
    }
  }

  Extensions {
    css = text/css
    gif = image/gif
    html = text/html
    jpe = image/jpeg
    jpeg = image/jpeg
    jpg = image/jpeg
    png = image/png
    tif = image/tiff
    tiff = image/tiff
    txt = text/plain
  }
}

ErrorHandling {
    CallUserHandlerOnFatals = true
    NoInfiniteRecursionDetection = false
    ThrowBadTypeExceptions = false
    ThrowTooManyArguments = false
    WarnTooManyArguments = false
    ThrowMissingArguments = false
    ThrowInvalidArguments = false
    EnableHipHopErrors = true
    NoticeFrequency = 1    # 1 out of these many notices to log
    WarningFrequency = 1   # 1 out of these many warnings to log
    AssertActive = false
    AssertWarning = false
  }

Repo {
  Central {
    Path = /var/log/hhvm/.hhvm.hhbc
  }
}

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

MySQL {
  TypedResults = false
}

以上是关于ini HHVM 3.0上的Nginx配置示例的主要内容,如果未能解决你的问题,请参考以下文章

ini HHVM / php.ini中

HHVM 3.0 发布,执行 PHP 的虚拟机

ini nginx代理缓存配置文件示例

ini Nginx示例配置文件。

ini NGINX配置示例,用于为Node进程提供自己的配置

ini 示例Nginx配置,用于为反向代理API添加跨源资源共享(CORS)支持