## Installing on Mac
1. Cloning
```bash
git clone -o ecs -b master git@server-ip:/home/ts/www/yiiapp yalong
```
2. Init yii app
```bash
cd yalong
./init
```
2. DB
Creat a database, and config db connection params in `common\config\main-local.php`
2. `composer install`
### Config Apache
```bash
sudo vi /etc/apache2/http.conf
# add folowing content
ServerName yalong.com
DocumentRoot "/Users/drodata/www/yalong/frontend/web"
# use mod_rewrite for pretty URL support
RewriteEngine on
# If a directory or a file exists, use the request directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Otherwise forward the request to index.php
RewriteRule . index.php
# use index.php as index file
DirectoryIndex index.php
# ...other settings...
ServerName i.yalong.com
DocumentRoot "/Users/drodata/www/yalong/backend/web"
# use mod_rewrite for pretty URL support
RewriteEngine on
# If a directory or a file exists, use the request directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Otherwise forward the request to index.php
RewriteRule . index.php
# use index.php as index file
DirectoryIndex index.php
# ...other settings...
ServerName file.yalong.com
DocumentRoot "/Users/drodata/www/yalong/file"
# use mod_rewrite for pretty URL support
RewriteEngine on
# If a directory or a file exists, use the request directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Otherwise forward the request to index.php
RewriteRule . index.php
# use index.php as index file
DirectoryIndex index.php
# ...other settings...
```
```bash
sudo vi /etc/hosts
#add the following content
127.0.0.1 yalong.com
127.0.0.1 i.yalong.com
127.0.0.1 file.yalong.com
#Restart Apache
sudo apachectl restart
```
Last step, change permission of `file/media`.
```bash
chmod -R g+w media
# usergroup of Apache in Mac is _www
sudo chown -R drodata:_www media
```
## 输入敏感数据
```
cd common
cp yii2-sensitive.json.sample yii2-sensitive.json
vi yii2-sensitive.json
# 输入数据库密码等敏感信息
```