【发布时间】:2020-02-20 17:42:39
【问题描述】:
我尝试部署一个全新的 laravel 应用程序。我安装了一个 laravel 5.8 并上传到 github 存储库。
自从我尝试运行 php artisan serve 后,存储库或项目文件夹正在工作,它成功显示了 laravel 主屏幕页面。
我尝试使用 ssh 连接到我的共享主机。
这是我已经完成的步骤:
- 通过 ssh 访问
- 创建一个项目文件夹
mkdir my-assignment-calculator然后 cd my-assignment-calculator - 克隆项目存储库。
git clone **repo_url** - 浏览项目文件夹,
cd my-assignment-calculator - 复制 .env 文件,
cp .env-example .env - 安装作曲家包。
composer install - 然后将
Public文件夹中的所有文件复制到public_html文件夹中 - 转到 public_html 然后更新 index.php,
nano index.php - 在 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 欢迎或主屏幕页面
【问题讨论】:
-
尝试替换“DIR”。使用完整路径,我注意到“DIR”。不适用于某些服务器。
标签: php laravel laravel-5 deployment web-hosting