HHNVM与Nginx fastcgi无法正常工作

Bob*_*ijt 4 fastcgi nginx hhvm

我想通过Nginx使用HHVM.(Ubuntu 12.04.2 LTS,PHP 5.3.10)

我按照这里提到的步骤进行了访问:http:
//www.hhvm.com/blog/1817/fastercgi-with-hhvm

这就是我的Nginx设置的外观:

server {
        listen  80;
        server_name demo1.dev
        server_name_in_redirect off;
        root /var/www/demo1;
        location / {
                index index.php;
                try_files $uri $uri/ @handler;
                expires 30d;
        }
        location @handler {
                rewrite / /index.php;
        }
        location ~ .php$ {
                fastcgi_keep_conn on;
                if (!-e $request_filename) { rewrite / /index.php last; }
                expires        off;
                fastcgi_pass   127.0.0.1:9000;
                fastcgi_param PHP_VALUE "error_log=/var/report/PHP.error.log";
                fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
                include        fastcgi_params;
        }
        location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
                expires 1y;
                log_not_found off;
        }
}
Run Code Online (Sandbox Code Playgroud)

我有一个名为hhvm.php的文件,其中包含:

function is_hhvm() {
    return defined('HHVM_VERSION');
}

if (is_hhvm()) {
    echo "HHVM is working\n";
} else {
    echo "HHVM is not working\n";
}
Run Code Online (Sandbox Code Playgroud)

我做错了什么,我怎么看HHVM是否正常工作?

更新:输出: ps auxf | grep hhvm

root     15164  0.0  0.0   9360   660 pts/0    S+   13:55   0:00                          \_ grep --color=auto hhvm
www-data 15142  4.2  6.3 576564 122484 ?       Ss   13:54   0:01 /usr/bin/hhvm --config /etc/hhvm/server.hdf --user www-data --mode daemon
www-data 15154  7.0  6.3 580668 122636 ?       Ss   13:54   0:01 /usr/bin/hhvm --config /etc/hhvm/server.hdf --user www-data --mode daemon -vServer.Type=fastcgi -vServer.Port=9000 -vPidFile=/var/run/hhvm/hhvm-fastcgi.pid
Run Code Online (Sandbox Code Playgroud)

Pau*_*jan 10

一切看起来都合适.你可以尝试使用php-fpm完全相同的ngingx配置,看看它是否有效?也许你有一个目录权限问题.还要确保您实际上hhvm-fastcgi正在使用该进程,/etc/init.d/hhvm-fastcgi start并且在运行之前没有任何内容正在侦听端口9000.您可以运行ps auxf | grep hhvm以确保它正在运行和监听.

  • 是的,您可以将9000更改为您想要的任何内容.确保更改ngingx配置并更改/etc/init.d/hhvm-fastcgi (3认同)