douzai6337 2017-04-18 07:20
浏览 102

Laravel 5.2生产应用程序部署

I developed application in laravel 5.2. I was using the Virtual host on local and pointing publice/index.php easily.

But on production why we need to using the put index.php & all stuff out of public folder. Is this best practice to deploy on production?

I copied whole in project folder and public folder stuff copied on the root(public_html) of server.

I changed the index.php accordingly and its working fine.

require __DIR__.'/project/bootstrap/autoload.php';


$app = require_once __DIR__.'/project/bootstrap/app.php';

Issue is When i use auto deployment tool, It pushes whole code in project folder. Every time I move assets by ssh from project/public/assets to root/assets manually.

Main Issue I am also facing issue, saving profile picture in assets folder. But it save picture in project/public/asset instead it should in root/assets. I am really confused on this issue too.

Advise me Please recommend me the best practice, where should i keep public folder stuff and how to manage auto deployment.

Can we keep index.php inside public and point directly index.php here. In this way auto deployment work fine.

Issue in after deployment commands I am using DeployHQ.com to deploy my code. It execute ssh commands, but unfortunatly my command doesn't work because artisan file is inside of root/abc/project folder. I dont know where this shell execute commands. or How to point project folder directly to execute these commands.

Bitbucket webhook return 422 error code I am using bitbucket webhook on approve event. I have given it deployment url and auto deployment is switched on. Hook triggerred as well, but it didn't deploy any thing, It shows error code 422 and error "Could not decode the deployement".

  • 写回答

1条回答 默认 最新

  • duanchi4544 2017-04-18 08:01
    关注

    The index.php file should be in the public folder. Everything else should not. Your web server should be configured to point to this directory.

    The index.php file bootstraps the Laravel framework. The framework files should sit in a directory outside of the publicly accessible folder. This is usually in the directory above the public/ folder.

    You shouldn't work around your deployment tool. It should be configured to maintain this directory structure. Once there is no confusion as to where files should be pushed, you can begin to solve your other path related deployment problems. To avoid future pain, I'd recommend setting up your dev environment as close to production as possible.

    评论

报告相同问题?

悬赏问题

  • ¥17 pro*C预编译“闪回查询”报错SCN不能识别
  • ¥15 微信会员卡接入微信支付商户号收款
  • ¥15 如何获取烟草零售终端数据
  • ¥15 数学建模招标中位数问题
  • ¥15 phython路径名过长报错 不知道什么问题
  • ¥15 深度学习中模型转换该怎么实现
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 如何用python向钉钉机器人发送可以放大的图片?
  • ¥15 matlab(相关搜索:紧聚焦)