The first question is: can you run composer on you deployment server?
If the answer is no then you need to copy all the files of your project.
If the answer is yes then copy composer.json and composer.lock then run (composer.lock is need to preserve the component version you used during the development)
composer install
This will install yii2 and all the extensions that are in composer.json at the version saved in composer.lock
DO NOT RUN COMPOSER UPDATE, unless you want to UPDATE to never versions.
Normally in production environment you must run always composer install
Making update directly in production without testing if never version break your code is a bad idea.
run requirements.php to check if your server meet the yii2 minimum requirement (you should have done it long time ago)
Copy your project files, which on basic template are typically:
- assets
- commands
- config
- controllers
- mail
- migrations
- models
- views
- web
- open web/index.php and set
defined(‘YII_DEBUG’) or define(‘YII_DEBUG’, false);
defined(‘YII_ENV’) or define(‘YII_ENV’, ‘prod’);
false: this disable the generation of debug info
prod: this will disable all the module (i.e. gii) declared in dev section of the config file (look at the end of config/web.php if (YII_ENV_DEV) {…)
-
set your db connection(s) according to production environment
-
regarding the .htaccess I hope you developed your site with the rewrite already active
-
basic template is secure at same level as advanced one, in few words it is only a more simple scheme when you do not need frontend and backend
Another question: in production are you using the development db with the data or you want to start with a blank one?
Using the development db: just export/import it
Starting with a blank one:
-
Apply framework and module migration
-
apply your models migration (if you have them) or export and import your model schema
-
populate the table that need to be filled (RBAC, Users, ‘Master Table’…)
At this point your site is up and running.
I think it is all, but probably I forgot something and others have more to add.