Deploy Magento 2 Project

Deploy Magento 2 Project

This post shows you how to deploy your Magento 2.1 Project to online hosting.

Step one: You need to export your website database to sql or .zip file.

use this command:

mysqldump -u'database user' -p'password' [database_name] > sql_file.sql

 

— connect to your ssh server.
Step Two: Replace your old domain with new domain in your database, using sed command

sed -i 's/olddomain.com/newdomain.com/g' sql_file.sql

 

Step Three: Upload your local code to your Web-Server, you can Compress your code then upload it to the server.
– List of folder you can remove before that

  • —– var/generation
  • —– var/cache
  • —– pub/static/_required
  • —– pub/static/frontend
  • —– pub/static/backend
  • —– pub/media/catalog/product/cache/

Last Step: Edit your env.php file from app/code/env.php

Remember set default magento cronjob: http://devdocs.magento.com/guides/v2.0/config-guide/cli/config-cli-subcommands-cron.html

Run commandline:

bin/magento maintenance:enable;
bin/magento setup:upgrade; 
bin/magento deploy:mode:set production.

 

Comments are closed.