如何正确地将Laravel 5应用程序上传到服务器?

时间:2015-03-25 16:16:15

标签: laravel-5

我是Laravel 5的新手并且已经意识到很多已经改变,我对Laravel 4更熟悉。我只是尝试将我的网站上传到实时VPS,我设法更改了index.php中的网址server.php但我一直收到这些错误:

NetworkError:

这让我相信还有其他我应该改变的东西我没有,因为这些文件确实在那里,我的应用程序在我的本地主机上工作得很好。

除了我的主页外,当我点击他们的链接时,其他页面都说没有找到。

这是我的文档结构:

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 <taylorotwell@gmail.com>
 */

$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';

1 个答案:

答案 0 :(得分:2)

在接下来的步骤中,必须遵循将本地移动到Laravel中的实时服务器。

  1. 将所有公用文件夹数据移动到根目录

  2. 在index.php中将路径更改为 需要 DIR 。'/ .. / bootstrap / autoload.php';要求 DIR 。'/ bootstrap / autoload.php';

    $ app = require_once DIR 。'/ .. / bootstrap / app.php';至$ app = require_once DIR 。'/ bootstrap / app.php';

    并将文件权限设置为744

  3. 在.htaccess文件中,在RewriteEngine On后添加以下代码。

    RewriteBase /

  4. 更改.env文件中的参数。