1

我按照https://github.com/hhvm/hack-example-site上的说明进行操作,但在通过 ubunut 14.04 在 ngnix 上设置 hhvm hack 站点时不知何故迷路了。请注意,我为 14.04 使用了适当的 apt-get repo。

但是,在配置并尝试访问 127.0.0.1:9000 后,我在 /var/log/hhvm/error.log 中看到一个错误

FastCGI protocol: received an invalid record

我的 /etc/ngnix/sites-enabled 如下

-rw-r--r-- 1 root root  0 Aug 30 22:01 default
lrwxrwxrwx 1 root root 44 Aug 30 22:21 hack-example-site -> /etc/nginx/sites-available/hack-example-site

/etc/ngnix/sites-available/hack-example-site 的内容如下:

server {
  root ~/hack-example-site/hack-example-site;
  index index.php;
  location ~ \.php$ {
    # If fastcgi backend is on another server disable this.
    # Read issue #6 about this
    try_files $uri =404;

    fastcgi_pass  127.0.0.1:9000;
    fastcgi_index index.php;
    #fastcgi_param SCRIPT_FILENAME ~/hack-example-site/hack-example-site/index.php
    fastcgi_param ~/hack-example-site/hack-example-site        $document_root$fastcgi_script_name;
    include fastcgi_params;
  } 
}

有人可以帮助我在我的本地主机上运行这个 hhvm 站点吗?谢谢。

哦,请注意 ngnix 已正确安装并且服务器响应 localhost。

配置文件 /etc/nginx/sites-available/hack-example-site 如下:

server {
  root /root/hack-example-site;
  index index.php;
  server_name localhost;
  location ~ \.php$ {
# If fastcgi backend is on another server disable this.
# Read issue #6 about this
try_files $uri =404;

fastcgi_pass  127.0.0.1:9000;

fastcgi_index index.php;

#fastcgi_param SCRIPT_FILENAME ~/hack-example-site/hack-example-

网站/index.php

fastcgi_param /root/hack-example-site 

$document_root$fastcgi_script_name;

include fastcgi_params;

} } ~

4

1 回答 1

0

我确实找到了一种方法来测试我的 hack 脚本,但对此并不满意。我创建了符号链接

/etc/ngnix/sites-enabled/default->/etc/ngnix/sites-available/default.

将 test.php 复制到 /usr/share/nginx/html 中,其中包含用 hack 编写的简单 hello world。编辑 /etc/nginx/sites-available/default 如下:

server {
    listen 80 default_server;
    listen [::]:80 default_server ipv6only=on;

    root /usr/share/nginx/html;
    #index index.html index.htm;
    index test.php;
    # Make site accessible from http://localhost/
    server_name localhost;
    include hhvm.conf;

现在,当我访问 localhost 时,执行了 hackscript 并显示了 Helloworld。

但是,我希望它可以与 /etc/nginx/sites-available/hack-site-example 一起使用,而不是默认。不知道那里发生了什么?任何人都可以发光吗?
于 2014-08-31T03:39:06.917 回答