将Laravel部署到Live Server [英] Deploying Laravel to Live Server

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

问题描述

我有一个共享的Linux live服务器,该服务器已购买用于托管网站.我已经检查了配置,并在Cpanel.Laravel中看到了一个框架部分.如果单击,它将下载框架.现在,我想知道是否可以将已编写的Laravel应用程序在本地主机上完美运行,是否可以将其部署到实时服务器上?如果是,该怎么办?我将所有文件复制到我的www目录中还是什么? 还是我必须再次直接在Web上重写代码.如果可以的话,我将如何使用那些Artisan命令?

I have a shared linux live server that has been purchasing for hosting of website. I have checked the configuration, and saw a section for framework in the Cpanel.Laravel is there. If it is clicked, it will download the framework. Now, I like to know if my already written laravel application working perfectly in my localhost can be deployed to the live server? If yes, how can this done? Will I just copy all the files into my www directory or what? Or will I have to rewrite the code directly on the web again. If this is the option, how will i use those Artisan command?

请,我是laravel框架部署的新手.

Please, I a new to deployment of laravel framework.

推荐答案

在共享主机上,您无法运行artisan命令,不能在共享主机上享受所有laravel功能,需要vps或专用服务器,在共享主机上需要做大量的手动工作,例如旧的php网站上载和数据库更新,如果要在共享主机上上载laravel项目的任何方法,请按照以下步骤操作.

on shared hosting you can not run artisan commands, you can not enjoy all laravel features on shared hosting, you need vps or dedicated server, on shared hosting you need to do so much manual work, like old php site uploading, and database update, any ways if you want to upload laravel project on shared hosting follow these steps.

  1. 在托管根目录上创建目录名称框架并上传 从本地到框架目录的所有内容(公共除外) 目录.
  2. 从您的www目录中公共目录中上传所有内容 主持人.
  3. 现在修改您的index.php文件
  1. create a directory name framework on your hosting root and upload everything from your local to framework directory except public directory.
  2. upload all content from public directory in www directory on your host.
  3. now modify your index.php file

转到index.php并编辑第22行

Go to index.php and edit the line 22

#From this
require __DIR__.'/../bootstrap/autoload.php';
#To this
require __DIR__.'/../[framework-folder]/bootstrap/autoload.php';

第36行

#From this 
$app = require_once __DIR__.'/../bootstrap/app.php';
#To this
$app = require_once __DIR__.'/../[framework-folder]/pulcro/bootstrap/app.php';

  1. 修改.env文件并放入数据库凭据

现在浏览您的应用.

有关更多信息,请阅读此论坛帖子.

for more information read this forum post.

http://laravel.io/forum/03-06-2015-how-to-setup-laravel-5-in-shared-hosting

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

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