Deploying laravel project

Posted 5 months ago by jwillz21

I'm trying to deploy my project on a server, Its a RESTAPI. the server is running apache and is working properly (I tested it with a hello world script).

My project itself is in /var/API. I've moved my public folder from my project to my document root (/var/www/). I've altered my index.php document from my laravel project and added it to my document root, along with my public/.htaccess. The problem I'm having lies in my altered index.php file posted below.

If I run a get API call i get a 404 error in my browser. If I just run the ip for the server itself I get a 500 error.

<?php

define('LARAVEL_START', microtime(true));

require __DIR__.'/var/API/vendor/autoload.php';

$app = require_once __DIR__.'/var/API/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);

Please sign in or create an account to participate in this conversation.

Laracasts Mascot

Hi, Have We Met Yet?

Did you know that, in addition to the forum, Laracasts includes well over 1000 lessons on modern web development? All for the price of one lunch out per month.

Sign Me Up

Channels

Reply to

Use Markdown with GitHub-flavored code blocks.