繁体   English   中英

nginx - laravel - hhvm-Fastcgi得到错误500

[英]nginx - laravel - hhvm-Fastcgi get error 500

我在ubuntu 12.04 LTS 64 whit HHVM Fastcgi服务中安装LEMP服务器,我通过laravel.phar安装laravel(并通过composer测试)当在brwoser中获取我的网站时不显示任何错误但在Chrome开发人员控制台中获取错误500 在此输入图像描述

我在error.log文件中看不到任何错误(laravel - hhvm,nginx)

存储目录权限是777

我的nginx.conf和vhosts文件有基本配置

当我使用PHP CLI或hhvm命令时,它运行良好

谢谢你的帮助:)

我的位置块

location ~ \.(hh|php)$ {
fastcgi_split_path_info ^(.+\.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的问题是它没有显示太多错误,你必须继续观察HHVM或Laravel错误日志。

您需要密切关注错误日志。 默认情况下,HHVM不会向浏览器报告错误。

检查HHVM日志!

$ tail -n 50 -f /var/log/hhvm/error.log

检查您的Laravel日志!

$ tail -n 50 -f /path/to/laravel/app/storage/logs/laravel.log

配置参考

如果文件尚未存在,请创建文件/etc/nginx/hhvm.conf 插入ff:

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;
}

然后将其包含在您的nginx虚拟主机配置中。
例如。 /etc/nginx/sites-available/laravel

现在为Laravel添加它,根据需要进行编辑:

server {
    listen 80 default_server;

    root /vagrant/laravel/public;
    index index.html index.htm index.php;

    server_name localhost;

    access_log /var/log/nginx/localhost.laravel-access.log;
    error_log  /var/log/nginx/locahost.laravel-error.log error;

    charset utf-8;

    location / {
        try_files \$uri \$uri/ /index.php?\$query_string;
    }

    location = /favicon.ico { log_not_found off; access_log off; }
    location = /robots.txt  { log_not_found off; access_log off; }

    error_page 404 /index.php;      

    include hhvm.conf;  # INCLUDE HHVM HERE

    # Deny .htaccess file access
    location ~ /\.ht {
        deny all;
    }
}

然后重新加载Nginx:

$ sudo service nginx reload

由于X-Powered-By标头由HHVM设置,我假设您的NGINX配置正确。 500错误主要来自语法错误或应用程序中抛出的异常。 也许你在NGINX中的fastcgi设置仍然是错误的。 location *\\.php内有什么location *\\.php块?

尝试一个不易出错的设置并运行php artisan serve来本地托管您的项目。

您可以修改Laravel的句柄异常类,以便在使用HHVM时显示错误。

详细信息请访问: https//github.com/laravel/framework/issues/8744#issue-76454458

我测试了这个,它在带有HHVM的Homestead上的Laravel 5.2 / 5.3上运行良好。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM