php-Nginx和HHVM始终返回404

前端之家收集整理的这篇文章主要介绍了php-Nginx和HHVM始终返回404 前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

我知道这不是一个普遍的问题,但是我似乎无法以某种方式找到直接的答案.有人能够尽可能直接地回答这个问题吗?

我的Nginx(提供静态文件)和HHVM(从控制台中的hhvm index.PHP)工作正常,但是我无法通过Nginx访问.PHP而没有得到404

情况:
HHVM 3.5.0
Nginx 1.7.9

我在/etc/Nginx/conf.d/default.conf中有这个

server {
    listen       80;
    server_name  localhost;

    location / {
        root   /var/www;
        index  index.PHP index.html index.htm;
    }

    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /usr/share/Nginx/html;
    }

    include hhvm.conf;
}

在HHVM.conf中

location ~ \.(hh|PHP)${
    fastcgi_keep_conn on;
    fastcgi_pass   127.0.0.1:9000;
    fastcgi_index  index.PHP;
    fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include        fastcgi_params;
}
最佳答案
将以下HHVM conf替换为您的:

location ~ \.(hh|PHP)${
    fastcgi_keep_conn on;
    fastcgi_pass   127.0.0.1:9000;
    fastcgi_index  index.PHP;
    fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include        fastcgi_params;
}

问题

我看到$document_root和$fastcgi_script_name之间有一个空格.

更新资料
通过使用/ var / www更改$document_root来解决

原文链接:https://www.f2er.com/nginx/532434.html

猜你在找的Nginx相关文章