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中有这个

  1. server {
  2. listen 80;
  3. server_name localhost;
  4. location / {
  5. root /var/www;
  6. index index.PHP index.html index.htm;
  7. }
  8. error_page 500 502 503 504 /50x.html;
  9. location = /50x.html {
  10. root /usr/share/Nginx/html;
  11. }
  12. include hhvm.conf;
  13. }

在HHVM.conf中

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

  1. location ~ \.(hh|PHP)${
  2. fastcgi_keep_conn on;
  3. fastcgi_pass 127.0.0.1:9000;
  4. fastcgi_index index.PHP;
  5. fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  6. include fastcgi_params;
  7. }

问题

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

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

猜你在找的Nginx相关文章