我在https://github.com/hhvm/hack-example-site在通过ubunut 14.04在ngnix上建立hhvm黑客网站时不知怎么迷路了。请注意,我在14.04使用了合适的apt-get-repo。
但是,在配置并尝试访问127.0.0.1:9000之后,我在/var/log/hhvm/error.log 中看到一个错误
FastCGI protocol: received an invalid record
启用的My/etc/ngnix/sites如下
-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示例站点的内容如下:
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/破解示例站点如下:
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-
site/index.php
fastcgi_param /root/hack-example-site
$document_root$fastcgi_script_name;
include fastcgi_params;
}}~
我确实找到了一个测试我的破解脚本的方法,但对此并不满意。我创建了符号链接
/etc/ngnix/sites-enabled/default->/etc/ngnix/sites-available/default.
将test.php复制到/usr/share/nginx/html,该文件使用hack编写了简单的helloworld。编辑/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;