是否可以共享一个Symfony2安装(在一台服务器上有多个网站[域]) [英] Is it possible to share an Symfony2 installation (multiple websites [domains] on one server)
问题描述
我想在一个根(服务器)下托管多个基于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 ..
推荐答案
我当然可以.需要记住的几件事:
I certainly looks possible. A few things to remember:
-
Symfony/vendors
文件夹包含所有与Symfony相关的代码.这可以在应用程序之间轻松共享. -
Symfony/app
文件夹包含与应用程序相关的文件,例如config和cache,并且不应在应用程序之间共享. -
Symfony/web
文件夹包含将在其中提供应用程序的公用文件夹,并且不应被共享. -
Symfony/src
文件夹包含您的分发包,可以根据需要进行共享
- The
Symfony/vendors
folder contains all the Symfony related code. This can easily be shared between applications. - The
Symfony/app
folder contains application related files like the config and cache, and shouldn't be shared between applications. - The
Symfony/web
folder contains the public folder from which the application will be served, and shouldn't be shared. - The
Symfony/src
folder contains your bundles, and can be shared, depending on your needs
因此至少,请执行以下操作:
So at the very least, do the following:
- 制作
web
和app
文件夹的副本.将副本保留在Symfony
文件夹中. AFAIK,没有简单的方法可以将这些文件夹放置在不同的位置. - 在新的
app
文件夹中,编辑app.php
和app_dev.php
.将对app
文件夹的所有引用替换为新的/第二个应用程序文件夹的名称. - 在命令行上运行
php newapp/console assets:install newapp
以安装捆绑的资产.
- Make copies of the
web
andapp
folders. Keep the copies in theSymfony
folder. AFAIK, there's no easy way to have these folders in different locations. - In the new
app
folder, edit bothapp.php
andapp_dev.php
. Replace all references to theapp
folder with the name of your new / second app folder. - Run
php newapp/console assets:install newapp
on your command line to install the bundled assets.
我确定您也可以复制src
文件夹,尽管我还没有尝试过.无论如何,重复使用捆绑包都是个好主意.
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.
这篇关于是否可以共享一个Symfony2安装(在一台服务器上有多个网站[域])的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!