Laravel部署 [英] Laravel Deployment

查看:82
本文介绍了Laravel部署的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的桌面上有一个可运行的Laravel应用程序.我正在尝试将其部署到Godaddy服务器.该应用程序已在服务器上以与我的台式机相同的结构格式进行了复制和验证.我已将配置中的数据库信息更改为正确的条目.当我从服务器运行时,出现错误:

I have a working Laravel application on my desktop. I am trying to deploy it to a godaddy server. The application has been copied and verified on the server in the same structure format as on my desktop. I have changed the database information in the config to the proper entries. When I run from the server I get the error:

FatalErrorException

Class 'name of the class' not found.

该错误在Routes.php文件中生成. 该应用程序再次在本地运行,是否知道为什么在部署时会出错?

The error is generated in the Routes.php file. Again this app works locally, any idea why it errors when deployed?

推荐答案

假设您有一台 VPS服务器,并且运行Apache(或其他任何方式)并具有正确配置的虚拟主机和终端(ssh)访问权限(如果有)您想要在此处部署Laravel应用,您肯定需要

Assuming you have a VPS server running Apache (or whatever else) with a a properly configured vhost and terminal (ssh) access, if you want deploy a Laravel app there, you surely need to

  1. 将除供应商目录之外的所有项目文件从localhost复制到您的服务器
  2. 验证文件所有权和访问权限(chown/chmod)
  3. 更改所有必要的配置
  4. 运行composer update
  5. 运行php artisan migrate创建数据库方案
  6. 清除缓存php artisan cache:clear
  1. Copy all project files, except for the vendor directory, from localhost to your server
  2. Verify file ownage and access rights (chown/chmod)
  3. Change all necessary config
  4. run a composer update
  5. run php artisan migrate to create the database scheme
  6. clear cache php artisan cache:clear

下一步是使用来自本地主机的应用程序数据填充数据库.您可以手动执行此操作(将sql转储到本地,将其导入服务器上),或者如果需要Laravel,则可以使用Seeding( Laravel文档).

Next thing is populating the database with your apps data from localhost. You can either do it manually (dump sql local, import it on server), or if you want Laravel for it you can use Seeding (Laravel docs).

甚至还有一个不错的软件包,让您从当前数据库内容中自动生成Seeders-因此,对于将应用程序移至另一台服务器非常有用.

There even is a nice package that let's you automaticaly generete Seeders from your current database content - so it's very useful for the purpose of moving the app to another server.

https://github.com/orangehill/iseed

反向种子生成器(iSeed)是Laravel 4软件包,可提供 基于现有数据生成新种子文件的方法 数据库表.

Inverse seed generator (iSeed) is a Laravel 4 package that provides a method to generate a new seed file based on data from the existing database table.

编辑

如果您使用的是共享托管帐户,请查看本指南

EDIT

If you are using a shared hosting account, check out this guide

> http://driesvints.com/blog/laravel-4-on-a-shared -主机

Laravel论坛上的这篇帖子也可能有用

This post from Laravel forum might also be of use

http://forums.laravel.io/viewtopic.php?id=9639

这篇关于Laravel部署的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆