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

2020-08-01 06:21发布

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

标签: symfony web root
1条回答
贪生不怕死
2楼-- · 2020-08-01 07:20

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)
查看更多
登录 后发表回答