簡體   English   中英

Laravel 5.8 全新部署在 Hostinger 共享托管中不起作用

[英]Laravel 5.8 Fresh Deployment Not Working In Hostinger Shared Hosting

我試圖部署一個新的 Laravel 應用程序。 我安裝了 laravel 5.8 並上傳到 github 存儲庫。

存儲庫或項目文件夾正在工作,因為我嘗試運行php artisan serve並成功顯示 laravel 主屏幕頁面。

我嘗試使用 ssh 連接到我的共享主機。

這是我完成的步驟:

  1. 通過 ssh 訪問
  2. 創建一個項目文件夾mkdir my-assignment-calculator然后 cd my-assignment-calculator
  3. 克隆項目存儲庫。 git clone **repo_url**
  4. 導航項目文件夾, cd my-assignment-calculator
  5. 復制 .env 文件, cp .env-example .env
  6. 安裝 Composer 包。 composer install
  7. 然后將Public文件夾中的所有文件復制到 public_html 文件夾
  8. 轉到 public_html 然后更新 index.php, nano index.php
  9. 在 index.php 中,我更新了這兩行,vendor/autoload.php 和 bootstrap/app.php

以下是#9 的示例代碼:

require __DIR__.'/../my-assignment-calculator/my-assignment-calculator/vendor/autoload.php';

/*
|--------------------------------------------------------------------------
| Turn On The Lights
|--------------------------------------------------------------------------
|
| We need to illuminate PHP development, so let us turn on the lights.
| This bootstraps the framework and gets it ready for use, then it
| will load up this application so that we can run it and send
| the responses back to the browser and delight our users.
|
*/

$app = require_once 
__DIR__.'/../my-assignment-calculator/my-assignment-calculator/bootstrap/app.php';

這是我的項目文件夾的結構

-public_html
-domains
    --my_assignment_calculator
    --my_assignment_calculator
        ---laravel files

當前輸出只有白屏。 我試圖檢查開發人員工具或開發工具,沒有錯誤。 這只是一個白色的背景。 這和以前一樣。

我試圖檢查 .htaccess 文件,但我沒有觸及這個文件。 這是.htaccess:

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews -Indexes
    </IfModule>

    RewriteEngine On

    # Handle Authorization Header
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

    # Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} (.+)/$
    RewriteRule ^ %1 [L,R=301]

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>

那么預期的輸出是多少

應該顯示 laravel 歡迎或主屏幕頁面

laravel 文件夾位於根目錄中,然后您的所有公共文件夾文件都將其傳輸到 public_html 中,然后通過添加如下所示的 laravel 目錄轉到您的 public_html 配置中的索引文件:

require __DIR__.'/../laravel/vendor/autoload.php';
$app = require_once __DIR__.'/../laravel/bootstrap/app.php';

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM