Laravel 4 以及使用 FTP 部署应用程序的方式

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/22023048/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 09:05:49  来源:igfitidea点击:

Laravel 4 and the way to deploy app using FTP

phpapacheftplaravel

提问by Safari

I have a question about the way used to deploy a Laravel Application.

我对用于部署 Laravel 应用程序的方式有疑问。

I have developed my application locally using Composer.

我已经使用 Composer 在本地开发了我的应用程序。

Now, I'm ready to deploy this application to the production.

现在,我已准备好将此应用程序部署到生产环境中。

I have (at the moment) a production server that use only FTP..

我(目前)有一个只使用 FTP 的生产服务器。

I have read this forum: Laravel Forum

我读过这个论坛: Laravel 论坛

but I think that this is not correct..

但我认为这是不正确的..

I have created a directory on my server for example: http://wwww.myserver.com/app

我在我的服务器上创建了一个目录,例如:http: //www.myserver.com/app

In the /app directory I copied (by FTP) all my files...

在 /app 目录中,我(通过 FTP)复制了所有文件...

But this not work..I have to change something?

但这不起作用..我必须改变什么?

回答by Sas Sam

Let's say your doc. root folder is www

让我们说你的医生。根目录是 www

  1. Create a folder called laravel on your shared hosting (outside of www) and upload your application structure to this folder, except the public folder.
  2. Upload your public folder's content into the www folder
  3. Adjust the path structure in the bootstrap/paths.php file.
  4. Also change the paths in the www/index.php file to locate the new laravel folder.
  5. Done.
  1. 在您的共享主机上创建一个名为 laravel 的文件夹(在 www 之外)并将您的应用程序结构上传到此文件夹,公共文件夹除外。
  2. 将公共文件夹的内容上传到 www 文件夹
  3. 调整 bootstrap/paths.php 文件中的路径结构。
  4. 还要更改 www/index.php 文件中的路径以找到新的 Laravel 文件夹。
  5. 完毕。

There are 2 more solutions (and my one in more detailed as well) in the following article as well:

在下面的文章中还有另外 2 个解决方案(我的一个也更详细):

http://driesvints.com/blog/laravel-4-on-a-shared-host

http://driesvints.com/blog/laravel-4-on-a-shared-host

回答by Antonio Brandao

Did you try http://wwww.myserver.com/app/public?

你试过http://wwww.myserver.com/app/public吗?

If you didn't configure your bootstrap/paths.php and public/index.php, your site should open via http://wwww.myserver.com/app/public. But you also have to configure the database paths and credentials in app/config/database.php

如果您没有配置 bootstrap/paths.php 和 public/index.php,您的站点应该通过http://www.myserver.com/app/public打开。但是您还必须在 app/config/database.php 中配置数据库路径和凭据

In a normal setup, only the contents of your Laravel project's "public" folder should be placed in your "app" folder. All the other files are kept in a separate folder, in the root of your server.

在正常设置中,只有你的 Laravel 项目的“public”文件夹的内容应该放在你的“app”文件夹中。所有其他文件都保存在服务器根目录下的单独文件夹中。

This article shows how to configure the paths: http://myquickfix.co.uk/2013/08/hosting-laravel-4-on-cpanel-type-hosting-public_html/

本文展示了如何配置路径:http: //myquickfix.co.uk/2013/08/hosting-laravel-4-on-cpanel-type-hosting-public_html/

回答by Paula Bishop

I did the process for deploying my Laravel 4 app yesterday proposed by Sas Sam and did not need to install Composer--but I can see why people would do that, because with ftp, using Filezilla, I ran into the issue that out of over 3000 files, it missed--or rather copied "empty files" for four php files, including one of the major classes of the Illuminate class (RedirectRequests.php), causing the app to throw an error early on.

我昨天做了 Sas Sam 提出的部署 Laravel 4 应用程序的过程,不需要安装 Composer——但我明白人们为什么会这样做,因为使用 ftp,使用 Filezilla,我遇到了问题3000 个文件,它错过了——或者说复制了四个 php 文件的“空文件”,包括 Illuminate 类的一个主要类 (RedirectRequests.php),导致应用程序在早期抛出错误。

When I realized that file was empty, I spent several hours in Filezilla examining every file (there are a lot besides php files, but only php files that were empty were causing issues) in the Laravel folder I'd created, cross-referencing them with my local install, to paste code into a total of four "missing" php files, and it seems to be working fine now.

当我意识到文件是空的时,我在 Filezilla 中花了几个小时检查我创建的 Laravel 文件夹中的每个文件(除了 php 文件之外还有很多文件,但只有空的 php 文件会导致问题),交叉引用它们使用我的本地安装,将代码粘贴到总共四个“丢失”的 php 文件中,现在似乎工作正常。

So perhaps doing a linux install of Composer directly on the server and then doing a fresh install of the same version of Laravel might have avoided that, I've been having issues with GoDaddy getting SSH access to my project so elected to just fine-tooth-comb my project, instead. As long as you have all the files up there, properly referenced through the bootstrap.paths and public index.php files, it should work.

因此,也许直接在服务器上进行 Composer 的 linux 安装,然后全新安装相同版本的 Laravel 可能会避免这种情况,我一直在 GoDaddy 无法通过 SSH 访问我的项目时遇到问题,因此选择了细牙- 梳理我的项目,而不是。只要您拥有所有文件,并通过 bootstrap.paths 和公共 index.php 文件正确引用,它就应该可以工作。