将 Symfony 2 项目转移到托管的步骤? [英] Steps to move Symfony 2 project to hosting?

查看:28
本文介绍了将 Symfony 2 项目转移到托管的步骤?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经阅读了很多关于在生产服务器上部署 Symfony 2 项目的文章和问题,但仍然不清楚.Symfony 项目的部署看起来很糟糕——没有人知道如何正确地做到这一点.我想我看到的最好的主题是部署一个 Symfony2 项目,但仍然有很多问题`清楚.我看了看,发现那个问题里有人把自己的IP添加到了允许IP列表中,但这意味着只有这个IP才能访问这个站点,但我需要允许所有人使用它.

I have read a lot of articles and questions about deploying of Symfony 2 project on a production server, but still, this is not clear. Deploy of Symfony project looks like a hell - nobody knows how to do this correctly. I suppose the best topic I see was Deploying a Symfony2 project, but still, a lot isn`t clear. I read it, and find out that in that question person added his own IP to a list of allowed IP, but this means that only this IP can access this site, but I need to allow everybody use it.

以及如何使站点使用路径 www.mydomen.com 而不是 www.mydomen.com/web/app_dev.php/index(我可以通过 Symfony 的正确路径,但它在 app_dev.php 和通过托管之后工作,但它如何在/app_dev.php 之前工作?似乎 app-dev.php 应该永远在我的路上).

And how can I make site working with path www.mydomen.com, instead of www.mydomen.com/web/app_dev.php/index (I can correct path via Symfony, but it works after app_dev.php and via hosting, but how can it work before /app_dev.php? It seems like app-dev.php should always be in my path).

那么,我应该如何正确地将开发的项目从本地服务器逐步转移到生产服务器?

So how should I correctly transfer developed project from local server to production server step by step, please?

推荐答案

好的,我了解了如何在共享主机上正确部署应用程序.这是:

OK, I find out how to correctly deploy app on shared hosting. Here it is:

  1. 这取决于您拥有的托管类型:如果您有 SSH控制台,然后您可以在第 2 步之后在主机上执行此操作,如果您还没有然后在本地执行:运行命令 php app/console cache:clear--env=prod.
  2. 假设您有托管文件夹 youdomain/public_html,因此在public_html 必须位于所有网络文件中.您必须从 Symfony 项目(文件夹:app、src、供应商、bin;文件:deps、deps.lock)上传所有内容,youdomain 文件夹中的文件夹 web 除外.文件夹 web 中的所有内容都应上传到文件夹 public_html.
  3. 检查文件夹 app/cache 和 app/logs 的 CHMOD,应该有写权限.
  4. 如果public_html中没有文件.htaccess,则创建它并在其中添加这样的代码:https://raw.github.com/symfony/symfony-standard/master/web/.htaccess
  5. 现在你应该使用 youdomain.com/index 而不是youdomain.com/app_dev.php/index,您在本地使用.
  1. It depends on kind of hosting that you have: if you have SSH console, then you can do it on hosting after step 2, if you haven't then do it locally: run command php app/console cache:clear --env=prod.
  2. Suppose you have on you hosting folders youdomain/public_html, so in public_html must be located all web files. You must upload all from Symfony project (folders: app, src, vendors, bin; files: deps, deps.lock), except folder web in folder youdomain. Everything from folder web should be upload to folder public_html.
  3. Check CHMOD for folders app/cache and app/logs, there should be write access.
  4. If there is no file .htaccess in public_html, then create it and add such code in it: https://raw.github.com/symfony/symfony-standard/master/web/.htaccess
  5. Now you should use youdomain.com/index instead of youdomain.com/app_dev.php/index, that you use locally.

如果您的站点仍然无法运行,您可以打开文件 web/config.php 并找到执行 IP 检查的代码,您会发现只有 IP 127.0.0.1,添加您当前的IP 到此列表并在服务器上上传新配置.然后你可以打开路径 yourdomain/config.php 并检查有什么问题.如果 config.php 显示一切正常,但您的网站仍然无法运行,您可以启用 app_dev.php 进行调试:打开 app/app_dev.php 并将您的 IP 添加到列表中,就像之前完成的 config.php 一样.现在您可以使用 app_dev.php 在本地运行脚本.

If your site still did not works, you can open file web/config.php and find the code where the check for IP performed, you find there only IP 127.0.0.1, add your current IP to this list and upload new config on a server. Then you can open path yourdomain/config.php and check what's wrong. If config.php shows that everything ok, but your site still didn't work, you can enable app_dev.php to debug: open app/app_dev.php and add your IP to the list as for config.php done before. Now you can run scripts as locally using app_dev.php.

这篇关于将 Symfony 2 项目转移到托管的步骤?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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