简体   繁体   中英

Problems with deploying symfony project to production server

I have a question about Symfony deployment. I'm struggling with it for about 2 days allready...

What am i doing wrong?

sudo rsync -avCz  --no-o --no-g --no-p --del --dry-run . [  PATH (private)  ]  --exclude 'web' --exclude '.htaccess' --exclude 'cgi-bin/'

After that i run this command without --dry-run

When i run this command the project is deployed to the right place. So far, so good. (After that can i manually copy the webfolder in the public_html folder?) After doing that i login to the server with ssh and navigate to the folder where my app is located. Well then i run this commands:

php app/console doctrine:schema:update --force   <-- to update my database
sudo php app/console assets:install ../public_html --symlink  <-- install assets
sudo php app/console assetic:dump --env=prod --no-debug --force <-- dump assets
php -d memory_limit=256M app/console cache:clear --env=prod --no-debug <-- clear cache

I also checked if the links in app.php

When i visit the weblink i see an blank page. Can somebody please help me?

Assuming that you've properly configured vhost, blank page is most likely internal server error. I suggest you check apache2 log for this project and symfony2 log (app/logs) for more details.

From the information which you provided it looks like you have permission issues. You are running console commands as sudo user, so all generated files will require root access, unless you automatically set permissions for newly created files.

Try to set: sudo chown -R www-data:www-data project/

Also check parameters.yml file, if you have correct database configuration for this environment.

Here is a simple shell deployment script which I occasionally use when PHPCI (continuous integration) is not available. It doesn't perform database updates, just simply copies project from git repository and runs basic commands. I hope you will find it useful.

rm -rf /var/www/project.com
git clone --depth 1 git@bitbucket.org:sample/repo.git /var/www/project.com
cd /var/www/project.com
php /usr/local/bin/composer.phar install --optimize-autoloader --no-interaction
cp /home/user/deployment/parameters.yml /var/www/project.com/app/config/parameters.yml
cp -r /home/user/deployment/media /var/www/project.com/web/media
php /var/www/project.com/app/console cache:clear --env=prod --no-debug
php /var/www/project.com/app/console assetic:dump --env=prod --no-debug
sudo chmod -R 775 /var/www/project.com/app/cache
sudo chmod -R 775 /var/www/project.com/app/logs
sudo chown -R www-data:www-data /var/www/project.com

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM