Try Yii2 with Vagrant VM + Ansible provisioning = Complete readymade virtual server playground
MIT License
mc
, curl
, etc.)intl
, gd
, xdebug
etc.)/etc/hosts
and Virtual hosts in Nginx already set up too !vagrant plugin install vagrant-hostmanager vagrant-vbguest vagrant-cachier
vagrant up
will fail on the first run, just re-run it if you'll get Unknown configuration section
error)You don't need to have Ansible installed on host machine. It will be installed on VM and self-provisioning will be launched. So it is possible to run everything on Windows machine.
vagrant up
./provisioning/main.yml
, uncomment var and add your GitHub oAuth token into github_oauth_token
variabledefault: warning: connection refused. Retying...
messages and Vagrant never boot successfully - it seems to be a VirtualBox issue. Try to install some older VBox version. It is tested to work on Virtual Box 4.3.6.Hyper-V
enabled. You should disable it if you experience issues with VirtualBox machines.vagrant ssh
working out of the box.Ok, now if everything went fine you can access these Urls in your browser
http://yii2.local/ - frontend app
http://admin.yii2.local/ - backend app
http://phpmyadmin.yii2.local/ - phpMyAdmin
http://adminer.yii2.local/ - Adminer (Lightweight and simple GUI manager for MySQL, PostgreSQL, SQLite, MS SQL, Oracle, SimpleDB, Elasticsearch and MongoDB)
Gii code generator should be called like this http://yii2.local/index.php?r=gii
Note : These local domains .local
will be available on your host machine only if hosts
file was modified correctly. It should
be done automatically by vagrant-hostsmanager
plugin. But if url http://yii2.local/
or other is not found by your browser - make sure
your hosts
file contain correct assignment of VM IP and local domains:
It should have such lines :
192.168.33.33 yii2.local
192.168.33.33 admin.yii2.local
192.168.33.33 phpmyadmin.yii2.local
192.168.33.33 adminer.yii2.local
File location. On Linux
/etc/hosts
. On Windows%SystemRoot%\system32\drivers\etc\hosts
Input there ...
Table Name : actor
Model Class : Actor
Namespace : frontend\models
Press - Preview and then Generate
Input there ...
Model Class : frontend\models\Actor
Search Model Class : frontend\models\ActorSearch
Controller Class : frontend\controllers\ActorController
Press - Preview and then Generate
.../try-yii2/yii2-app-advanced
) make relations between Models etc. Whatever you wish!try-yii2
folder run vagrant ssh
to access virtual dev server via SSH. You can modify and setup additionally anything you want.vagrant provision
to update server config (WARNING! I can't guarantee that your changes will not be overwritten!)