![](/img/trans.png)
[英]Laravel How to setup a public_html folder in a shared hosting in hostinger
[英]Laravel 5.8 Fresh Deployment Not Working In Hostinger Shared Hosting
我試圖部署一個新的 Laravel 應用程序。 我安裝了 laravel 5.8 並上傳到 github 存儲庫。
存儲庫或項目文件夾正在工作,因為我嘗試運行php artisan serve
並成功顯示 laravel 主屏幕頁面。
我嘗試使用 ssh 連接到我的共享主機。
這是我完成的步驟:
mkdir my-assignment-calculator
然后 cd my-assignment-calculatorgit clone **repo_url**
cd my-assignment-calculator
cp .env-example .env
composer install
Public
文件夾中的所有文件復制到 public_html 文件夾nano index.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.