简体   繁体   English

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

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

I tried to deploy a fresh laravel application.我试图部署一个新的 Laravel 应用程序。 I installed a laravel 5.8 and upload to github repository.我安装了 laravel 5.8 并上传到 github 存储库。

The repository or project folder is working since I tried to run php artisan serve and it successfully shows the laravel home screen page.存储库或项目文件夹正在工作,因为我尝试运行php artisan serve并成功显示 laravel 主屏幕页面。

I tried to connect in my shared hosting using ssh.我尝试使用 ssh 连接到我的共享主机。

Here's the steps that I've done:这是我完成的步骤:

  1. Access thru ssh通过 ssh 访问
  2. create a project folder mkdir my-assignment-calculator then cd my-assignment-calculator创建一个项目文件夹mkdir my-assignment-calculator然后 cd my-assignment-calculator
  3. Clone project repository.克隆项目存储库。 git clone **repo_url**
  4. Navigate the project folder, cd my-assignment-calculator导航项目文件夹, cd my-assignment-calculator
  5. Copy .env file, cp .env-example .env复制 .env 文件, cp .env-example .env
  6. Install composer packages.安装 Composer 包。 composer install
  7. Then copy all files in Public folder to public_html folder然后将Public文件夹中的所有文件复制到 public_html 文件夹
  8. Go to public_html then update index.php, nano index.php转到 public_html 然后更新 index.php, nano index.php
  9. In index.php, I update these two lines, the vendor/autoload.php and the bootstrap/app.php在 index.php 中,我更新了这两行,vendor/autoload.php 和 bootstrap/app.php

Here's the sample code for #9:以下是#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';

Here's the structure of my project folder这是我的项目文件夹的结构

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

The current output is only white screen.当前输出只有白屏。 I tried to check the developers tools or devtools, there's no error.我试图检查开发人员工具或开发工具,没有错误。 It's just a white background.这只是一个白色的背景。 It's the same as before.这和以前一样。

I tried to check .htaccess file and I didn't touch this file.我试图检查 .htaccess 文件,但我没有触及这个文件。 Here is the .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>

So what is the expected output那么预期的输出是多少

Should display laravel welcome or home screen page应该显示 laravel 欢迎或主屏幕页面

laravel folder is in root then all your public folder files transfer it into public_html then go to your index file in your public_html configure by adding laravel directory like this: 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