是否可以共享 Symfony2 安装(一台服务器上的多个网站 [域])
我想在一个根(服务器)下托管多个基于 Symfony2 的网站。是否可以共享 symfony 自己的文件? (供应商等)。有人知道教程吗?管理起来困难吗? AFAIK Symfony 安装大约有 600MB,我不想以冗余方式保存它..
I want to host multiple Symfony2 based websites under one root (server). Would it be possible to share the symfony own files? (vendors etc.). Does someone know a tutorial? Is it hard to manage? AFAIK a Symfony installation has about 600MB and I don't want to save this in a redundant manner ..
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我看起来确实有可能。需要记住的几件事:
Symfony/vendors
文件夹包含所有与 Symfony 相关的代码。这可以轻松地在应用程序之间共享。Symfony/app
文件夹包含与应用程序相关的文件,例如配置和缓存,并且不应该在应用程序之间共享。Symfony/web
文件夹包含将从中提供应用程序的公共文件夹,并且不应该被共享。Symfony/src
文件夹包含您的捆绑包,并且可以根据您的需要进行共享因此至少,请执行以下操作:
web
和app
文件夹。将副本保留在Symfony
文件夹中。 AFAIK,没有简单的方法可以将这些文件夹放在不同的位置。app
文件夹中,编辑app.php
和app_dev.php
。将所有对app
文件夹的引用替换为新/第二个应用程序文件夹的名称。我确信您也可以复制
src
文件夹,尽管我还没有尝试过。无论如何,重用你的包可能是个好主意。I certainly looks possible. A few things to remember:
Symfony/vendors
folder contains all the Symfony related code. This can easily be shared between applications.Symfony/app
folder contains application related files like the config and cache, and shouldn't be shared between applications.Symfony/web
folder contains the public folder from which the application will be served, and shouldn't be shared.Symfony/src
folder contains your bundles, and can be shared, depending on your needsSo at the very least, do the following:
web
andapp
folders. Keep the copies in theSymfony
folder. AFAIK, there's no easy way to have these folders in different locations.app
folder, edit bothapp.php
andapp_dev.php
. Replace all references to theapp
folder with the name of your new / second app folder.php newapp/console assets:install newapp
on your command line to install the bundled assets.I'm sure you can also copy the
src
folder, although I haven't experimented with that. Reusing your bundles is probably a good idea in any way.你说的是框架吗?如果是,您只需将该文件夹移动到服务器上的任何位置(假设为“/usr/local/symfony”),然后从您的站点中,只需从此目录加载自动加载器。
查看本页文档了解更多信息信息(在“安装验证”部分)。
如果您想在所有网站上使用相同的应用程序,则必须为此进行设计......
Are you talking about the framework ? If yes, you just can move the folder anywhere on your server (let's say '/usr/local/symfony') and from your sites, just load the autoloader from this directory.
Check out this page of the documentation for more info (in the "Installation Verification" part).
If you want to use the same application for all your websites, it has to be design for that...