将 Yii2 应用程序部署到共享主机步骤 [英] Deploying Yii2 app to shared host steps

查看:36
本文介绍了将 Yii2 应用程序部署到共享主机步骤的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我觉得很奇怪,关于将 Yii2 应用程序部署到共享主机服务器的注意事项的细节很少(如果有的话).

I find it bizarre that there is so little, (if any) details on considerations for deploying a Yii2 app to a shared host server.

有没有人有这方面的一些步骤、技巧和注意事项?

Does anyone have some steps, tips, considerations for this ?

您是否遵循了将问题/错误降至最低的流程?

Is there a process you follow that keeps issues/errors down to a minimum ?

如何迁移数据库(包含数据)?我假设我可以导出/导入数据库,直接复制 Yii 应用程序文件夹,但这似乎太简单了?

How does the DB get migrated (with data)? I'm assuming I could do export/import of the DB, copy the Yii app folder directly, but that seems too simplistic ?

推荐答案

首先阅读本页 http://www.yiiframework.com/doc-2.0/guide-tutorial-shared-hosting.html

关于文件是的,只需复制它们.如果您的主机允许您 ssh 访问(但不是 git),您可以使用 rsync 非常快速地复制它们(因此您可以在您的计算机上使用 composer 等并通过 ssh 进行部署).我做了一个类似的脚本,它在 1 点用 FTP 做同样的事情,但速度要慢得多.因为我已经停止为共享主机制作网站.

Regarding the files yes, just copy them. If your host allows you ssh access (but not git) you can have them copied very fast with rsync (so you can use composer etc on your computer and deploy through ssh). I have done a similar script that does the same thing with FTP at 1 point but it was much slower. Since I have stopped making websites for shared hosting.

关于迁移,您也可以让它们从浏览器运行,例如 如何在没有控制台访问权限的主机上处理 yii2 迁移?请确保您也阅读了答案和评论并点击该链接.

Regarding the migrations you can make them run from the browser too for example How to handle yii2 migrations on hosts without console access? Make sure you read the answer and the comments too and follow that link.

这篇关于将 Yii2 应用程序部署到共享主机步骤的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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