Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

nginx - laravel - hhvm-Fastcgi get error 500

I install a LEMP server in ubuntu 12.04 LTS 64 whit HHVM Fastcgi Service and i install laravel via laravel.phar ( and test via composer too ) when in get my site in brwoser do not display any error but in chrome developer console get error 500 enter image description here

i can't see any error in error.log file ( laravel - hhvm , nginx )

the storage directory Permissions is 777

and my nginx.conf and vhosts file have basic configuration

when i use PHP CLI or hhvm command it's worked good

thanks for help me :)

my location block

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;
like image 975
Mohammad Avatar asked Apr 23 '14 09:04

Mohammad


1 Answers

The problem with HHVM is it doesn't show much error, You have to keep watching the HHVM or Laravel error logs.

You'll want to pay close attention to your error logs. HHVM doesn't report errors to the browser by default.

Check the HHVM logs!

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

Check your Laravel logs!

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

config reference

Create a file /etc/nginx/hhvm.conf if it doesn't exist yet. Insert the 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;
}

Then include it on your nginx virtual host config.
eg. /etc/nginx/sites-available/laravel

Now add this for Laravel, edit as needed:

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

Then reload Nginx:

$ sudo service nginx reload
like image 105
majidarif Avatar answered Oct 01 '22 18:10

majidarif