Its better to put Symfony 2 in the “root” of the w

2020-08-01 06:28发布

问题:

Its better to put Symfony 2 in the "root" of the website (www) or in a sub-folder? And why?

Method 1

mysite/www/...

Method 2

mysite/www/symfony2/...

Thanks you in advance

回答1:

It is better to put Symfony folder outside of root web server's folder because only web folder of Symfony is meant to be public. By putting whole Symfony folder under root folder of web server you make all files public.

So best solution is to put Symfony folder somewhere outside web server's root folder (like /home/developer/symfonyProject) and then make symbolic link to web folder somewhere under web server root folder (does not really matter if in root folder or sub folder)

/home/developer/
├─ symfonyProject/
│  ├─ app
│  ├─ (...)
│  └─ web/
/var/www/
├─ symfony (this is link to /home/developer/symfonyProject/web)


标签: symfony web root