user3718908x100
user3718908x100

Reputation: 8519

How to correctly upload Laravel 5 application to server?

I am new to Laravel 5 and have realized that a lot has changed, I am more familiar with Laravel 4. I just tried uploading my site to a live VPS, I managed to change the URLs in index.php and server.php but I keep getting these errors:

NetworkError:

Which makes me believe there was something else I was supposed to change that I did not because these files are indeed there and my application works just fine on my localhost.

Also with the exception of my home page, the rest of the pages say not found when I click on their links.

This is my document structure:

Document Structure

index.php

<?php

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

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

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

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

$response->send();

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

server.php

<?php
/**
 * Laravel - A PHP Framework For Web Artisans
 *
 * @package  Laravel
 * @author   Taylor Otwell <[email protected]>
 */

$uri = urldecode(
    parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)
);

// This file allows us to emulate Apache's "mod_rewrite" functionality from the
// built-in PHP web server. This provides a convenient way to test a Laravel
// application without having installed a "real" web server software here.
if ($uri !== '/' and file_exists(__DIR__.'/../public_html'.$uri))
{
    return false;
}

require_once __DIR__.'/../public_html/index.php';

Upvotes: 2

Views: 4582

Answers (1)

vipul sorathiya
vipul sorathiya

Reputation: 1316

Following step you have must followed to move local to live server in Laravel.

  1. Move all public folder data into root directory

  2. In index.php change path to require DIR.'/../bootstrap/autoload.php'; to require DIR.'/bootstrap/autoload.php';

    AND

    $app = require_once DIR.'/../bootstrap/app.php'; to $app = require_once DIR.'/bootstrap/app.php';

    and set file permission to 744

  3. In .htaccess file add following code after RewriteEngine On.

    RewriteBase /

  4. Change parameter in .env file.

Upvotes: 2

Related Questions