Petras V.
Petras V.

Reputation: 187

NGINX: mywebsite.com is currently unable to handle this request. HTTP ERROR 500

Okay, so I get mywebsite.com is currently unable to handle this request. HTTP ERROR 500 /etc/nginx/sites-available/default:

server {
    listen 80;
    server_name mywebsite.com;

    root /home/www/tradescript/public;
    index index.php index.html index.htm;

    location / {
            try_files $uri $uri/ /index.php?$query_string;
    }
    location ~ \.php$ {
            try_files $uri /index.php =404;
            fastcgi_split_path_info ^(.+\.php)(/.+)$;

            fastcgi_connect_timeout 60;
            fastcgi_send_timeout 180;
            fastcgi_read_timeout 180;
            fastcgi_buffer_size 128k;
            fastcgi_buffers 256 16k;
            fastcgi_busy_buffers_size 256k;
            fastcgi_temp_file_write_size 256k;
            fastcgi_max_temp_file_size 0;

            fastcgi_pass unix:/var/run/php5-fpm.sock;
            #fastcgi_read_timeout 200;
            fastcgi_index index.php;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            include fastcgi_params;
    }
}

Inside of public folder there is my index.php:

<?php

require __DIR__.'/../bootstrap/autoload.php';

$app = require_once __DIR__.'/../bootstrap/app.php';

$kernel = $app->make(Illuminate\Contracts\Http\Kernel::class);

$response = $kernel->handle(
    $request = Illuminate\Http\Request::capture()
);

$response->send();

$kernel->terminate($request, $response);

I'm kinda newbie at this (nginx, laravel) and maybe you see some mistakes that I'm trying to find like 5 hours or so :D

Upvotes: 0

Views: 6506

Answers (2)

Vishal Khialani
Vishal Khialani

Reputation: 2587

I would enable the log as suggested by Aleksey and also the change below

  • fastcgi_split_path_info ^(.+.php)(.*)$;

  • fastcgi_max_temp_file_size 0; // U have disabled buffering not sure if that is a good idea. I would remove this unless you are sure what you are doing.

  • if the above two don't work then I would also write a much simpler php file with just phpinfo and try it out.

let me know how it went.

Upvotes: 0

Oleksii Dubinin
Oleksii Dubinin

Reputation: 72

First of all, I would suggest to add "error_log" line to the server`s config and look at the corresponding file and nginx error log. And after that it will be more clear where the problem is. Common problems: 1. php-fpm socket presence/permissions 2. app directory full path correctness or again - permissions.

Good luck!

Upvotes: 1

Related Questions