Symfony2 what to do when deploying manually?

匿名 (未验证) 提交于 2019-12-03 07:50:05

问题:

Since i can't find any useful information on Symfony2 website i'm asking here. What should be done when manually deploying a Symfony2 project? As far i understand:

  • Edit app/config/paramenters.ini to meet server paramenters

  • Update vendors to the latest version: php bin/vendors update

  • Install database with php app/console doctrine:database:create then tables with php app/console doctrine:schema:update --force and eventually load fixtures: php app/console doctrine:fixtures:load

  • Dump and install assets/assetics: php app/console assets:install --symlink web as long as php app/console assetic:dump --env=prod --no-debug

  • Symlink index.php to web/app.php, assuming that all files from Symfony2 distribution are in the root of the web server

  • Remove web/app_dev.php (is this really necessary?)

  • should app/config/paramenters.ini left untouched? What about security concerns?

Am i right? Thanks for helping. I think that Symfony2 documentation should cover this too.

EDIT: virtual host example:

<VirtualHost *:80>     ServerName symfony.local     DocumentRoot "C:/www/Symfony2/web"     DirectoryIndex app.php      <Directory "C:/www/Symfony2/web">         AllowOverride All         Allow from All     </Directory> </VirtualHost> 

回答1:

Only two things I wouldn't do is:

Symlink index.php to web/app.php, assuming that all files from Symfony2 distribution are in the root of the web server

Remove web/app_dev.php (is this really necessary?)

The thing with the symlink might be ok, but I prefer to link the webroot directory with the web directory of symfony2.

Second thing is, you don't have to remove app_dev.php, because it can only be run from localhost (it checks the IP). So no need to remove it, and I personally sometimes want to see debug info on the webpage (maybe not best way), and than I just add my own IP to app_dev (and remove it afterwards).



回答2:

Yes. That is all. And also you don't need web/app_dev.php in prod environment.

Moreover, web folder should be document root and run app.php



回答3:

I think you should put DirectoryIndex app.php inside <Directory></Directory>



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