简体   繁体   English

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

[英]Laravel 4 and the way to deploy app using FTP

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//wwww.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? 但这不起作用..我必须改变一些东西?

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. 在共享主机(www之外)上创建一个名为laravel的文件夹,并将您的应用程序结构上传到此文件夹,公共文件夹除外。
  2. Upload your public folder's content into the www folder 将您的公用文件夹的内容上传到www文件夹
  3. Adjust the path structure in the bootstrap/paths.php file. 调整bootstrap / paths.php文件中的路径结构。
  4. Also change the paths in the www/index.php file to locate the new laravel folder. 还要更改www / index.php文件中的路径以找到新的laravel文件夹。
  5. Done. 完成。

There are 2 more solutions (and my one in more detailed as well) in the following article as well: 在下面的文章中还有另外两个解决方案(我的一个也更详细):

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

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 . 如果您没有配置bootstrap / paths.php和public / index.php,那么您的站点应该通过http://wwww.myserver.com/app/public打开。 But you also have to configure the database paths and credentials in app/config/database.php 但您还必须在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. 在正常设置中,只应将Laravel项目的“public”文件夹中的内容放在“app”文件夹中。 All the other files are kept in a separate folder, in the root of your server. 所有其他文件都保存在服务器根目录中的单独文件夹中。

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/

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. 我做了部署我的Laravel 4应用程序的过程昨天由Sas Sam提出并且不需要安装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. 所以也许直接在服务器上安装了一个Linux安装的Composer,然后对同一版本的Laravel进行全新安装可能会避免这种情况,我一直遇到GoDaddy获得SSH访问我的项目的问题所以当选为精细的牙齿 - 而是我的项目。 As long as you have all the files up there, properly referenced through the bootstrap.paths and public index.php files, it should work. 只要你有所有文件,通过bootstrap.paths和public index.php文件正确引用,它应该可以工作。

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

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