I have read a lot of articles and questions about deploying of Symfony 2 project on a production server, but still, this is not clear. Deploy of Symfony project looks like a hell - nobody knows how to do this correctly. I suppose the best topic I see was Deploying a Symfony2 project, but still, a lot isn`t clear. I read it, and find out that in that question person added his own IP to a list of allowed IP, but this means that only this IP can access this site, but I need to allow everybody use it.
And how can I make site working with path www.mydomen.com
, instead of www.mydomen.com/web/app_dev.php/index
(I can correct path via Symfony, but it works after app_dev.php
and via hosting, but how can it work before /app_dev.php
? It seems like app-dev.php should always be in my path).
So how should I correctly transfer developed project from local server to production server step by step, please?
OK, I find out how to correctly deploy app on shared hosting. Here it is:
php app/console cache:clear
--env=prod
.youdomain/public_html
, so in
public_html
must be located all web files. You must upload all from Symfony project (folders: app, src, vendors, bin; files: deps, deps.lock), except folder web
in folder youdomain
. Everything from folder web
should be upload to folder public_html
..htaccess
in public_html
, then create it and add such code in it: https://raw.github.com/symfony/symfony-standard/master/web/.htaccess
youdomain.com/index
instead of
youdomain.com/app_dev.php/index
, that you use locally.If your site still did not works, you can open file web/config.php
and find the code where the check for IP performed, you find there only IP 127.0.0.1, add your current IP to this list and upload new config on a server. Then you can open path yourdomain/config.php
and check what's wrong. If config.php
shows that everything ok, but your site still didn't work, you can enable app_dev.php
to debug: open app/app_dev.php
and add your IP to the list as for config.php
done before. Now you can run scripts as locally using app_dev.php
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With