Is it possible to share an Symfony2 installation (multiple websites [domains] on one server)

本秂侑毒 提交于 2019-12-09 06:38:00

问题


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 ..


回答1:


I certainly looks possible. A few things to remember:

  1. The Symfony/vendors folder contains all the Symfony related code. This can easily be shared between applications.
  2. The Symfony/app folder contains application related files like the config and cache, and shouldn't be shared between applications.
  3. The Symfony/web folder contains the public folder from which the application will be served, and shouldn't be shared.
  4. The Symfony/src folder contains your bundles, and can be shared, depending on your needs

So at the very least, do the following:

  1. Make copies of the web and app folders. Keep the copies in the Symfony folder. AFAIK, there's no easy way to have these folders in different locations.
  2. In the new app folder, edit both app.php and app_dev.php. Replace all references to the app folder with the name of your new / second app folder.
  3. Run 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.




回答2:


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...



来源:https://stackoverflow.com/questions/6883628/is-it-possible-to-share-an-symfony2-installation-multiple-websites-domains-on

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!