This file covers all the steps needed to install a web server and Yii 2 framework to host a project in an Ubuntu 14.04 server.
First, the packages related to apache and php need to be installed:
sudo apt-get update
sudo apt-get install apache2
sudo apt-get install php5
Then you will need to install and enable GD and Mcrypt extensions:
sudo apt-get install php5-gd
sudo apt-get install php5-mcrypt
sudo php5enmod mcrypt
When installed, restart apache:
sudo service apache2 restart
We'll be using apache's vhosts feature, to allow hosting production and development environments in the same server. For that, we are following Digital Ocean's guide to setup vhosts.
Currently, we are using the following permissions:
ls -dl /var/www /var/www/*
drwxr-xr-x 4 root root 4096 Nov 3 09:42 /var/www
drwxrwxr-x 13 USER www-data 4096 Nov 3 10:43 /var/www/app.HOST.COM
drwxrwxr-x 13 USER www-data 4096 Nov 3 10:35 /var/www/dev.HOST.COM
We are going to deploy from a tool such as dploy.io, which needs to have write permissions on the virtual hosts.
Also, since Yii 2 appears to need write permissions too, we need to set www-data as every file's group.
This is a work in progress, currently it appears as if we have to run
chgrp -R www-data VHOST
after every deploy.
For this steps I'm following Yii's installation guide.
Install composer
globally:
curl -s http://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer
Install the composer asset plugin, to manage npm and and bower dependencies:
composer global require "fxp/composer-asset-plugin:1.0.0-beta3"
And finally, install a Yii 2 basic template project:
composer create-project --prefer-dist yiisoft/yii2-app-basic basic
what its the dir (route) of the index???