简体   繁体   English

将Laravel从我的本地主机上传到Godaddy服务器

[英]Uploading Laravel from my localhost to godaddy server

My set up in localhost works well. 我在localhost中设置的效果很好。 I want to upload my Laravel app to my GoDaddy server. 我想将我的Laravel应用上传到我的GoDaddy服务器。 I created an FTP to transfer my Laravel app to my GoDaddy server. 我创建了一个FTP,以将Laravel应用程序传输到GoDaddy服务器。 As what I've noticed upon creating my FTP account the files is inside /webroot so I created a /webroot/testapp inside testapp is my Laravel app. 正如我在创建FTP帐户时注意到的那样,文件位于/ webroot内部,因此我在/webroot/testapp内部创建的/webroot/testapp testapp是我的Laravel应用。 Inside Laravel app, there is a public folder. 在Laravel应用程序内部,有一个公用文件夹。 As what I've research in google other says only inside the public folder must be inside /public_html and Laravel app will be outside. 正如我在Google上进行的研究所得出的那样,其他人说,仅公共文件夹内必须在/public_html而Laravel应用将在外部。 in my case, it is /webroot . 就我而言,它是/webroot Now upon transferring my Laravel app to my server, I did not separate my public folder. 现在,将Laravel应用程序传输到服务器后,我没有分离公用文件夹。 I put it also in testapp folder because when I put the public folder outside my testapp folder and edit the index.php file my main site is in WordPress and it will cause an error. 我也将其放在testapp文件夹中,因为当我将公用文件夹放在testapp文件夹之外并编辑index.php文件时,我的主站点位于WordPress中,这将导致错误。 So I added the public folder into my testapp folder. 因此,我将公用文件夹添加到了我的testapp文件夹中。 When I tried to run in the browser it says 404 (Page Not Found) Error` so I tried to edit my index.php file below 当我尝试在浏览器中运行时,提示“ 404(找不到页面)”,因此我尝试在下面编辑index.php文件

<?php

/**
 * Laravel - A PHP Framework For Web Artisans
 *
 * @package  Laravel
 * @author   Taylor Otwell <taylor@laravel.com>
 */

/*
|--------------------------------------------------------------------------
| Register The Auto Loader
|--------------------------------------------------------------------------
|
| Composer provides a convenient, automatically generated class loader for
| our application. We just need to utilize it! We'll simply require it
| into the script here so that we don't have to worry about manual
| loading any of our classes later on. It feels great to relax.
|
*/

require __DIR__.'/../testapp/public/bootstrap/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__.'/../testapp/public/bootstrap/app.php';

/*
|--------------------------------------------------------------------------
| Run The Application
|--------------------------------------------------------------------------
|
| Once we have the application, we can handle the incoming request
| through the kernel, and send the associated response back to
| the client's browser allowing them to enjoy the creative
| and wonderful application we have prepared for them.
|
*/

$kernel = $app->make(Illuminate\Contracts\Http\Kernel::class);

$response = $kernel->handle(
    $request = Illuminate\Http\Request::capture()
);

$response->send();

$kernel->terminate($request, $response);

Now can someone help me to work this thing out? 现在有人可以帮我解决这个问题吗? I've seen it other tutorials is working well mine is not. 我看过其他教程都很好,我的不是。 Any help is muchly appreciated. 非常感谢任何帮助。 TIA TIA

You should upload the whole project from localhost to godaddy and then ask from the support team to edit your hosts pointing to public folder. 您应该将整个项目从localhost上传到godaddy,然后要求支持团队编辑指向公共文件夹的主机。

This is a shared hosting service , so you can't do it alone. 这是一项共享的托管服务,因此您不能一个人做。 Ask it. 问一下。

Crete .htaccess in root directory and add this below code:- 在根目录中创建Crete .htaccess并添加以下代码:-

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule    ^$    public/    [L]
RewriteRule    (.*) public/$1    [L]
</IfModule>

Hope it helps! 希望能帮助到你!

遵循本教程,它适用于任何共享主机计划。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM