## 框架信息
- 框架版本：Yii 2.0.12
- 框架使用文档：https://www.yiichina.com/doc/guide/2.0
- 
## 自动安装: （vender已经打包压缩到vender.tar.gz 可以直接解压试用）

进入项目根目录

1. `composer install`

2. 直接访问项目地址即可！


## 手动拷贝
1. 修改.env  数据库等相关配置
2. 添加cache、web/assets、web/admin/assets、web/api/assets等缓存、资源文件夹
    ```shell
    mkdir cache web/assets web/admin/assets web/api/assets   
    ```
3. 添加web/storage/install.txt安装标识文件
   ```shell
    touch web/storage/install.txt   
    ```
4. 拷贝vender目录
5. 添加local配置文件

## Yii2 项目服务端迁移部署方案：https://nodelog.cn/content/detail?id=623f2f91a52f5bb00ac92191&view=contentDetail

## nginx配置
~~~
server
{
    listen 80;
		listen 443 ssl http2;
    server_name rencai.jiangzi.xin;
    index index.php index.html index.htm default.php default.htm default.html;
    root /www/wwwroot/rencai.jiangzi.xin/server/web;

    #SSL-START SSL相关配置，请勿删除或修改下一行带注释的404规则
    #error_page 404/404.html;
    #HTTP_TO_HTTPS_START
    if ($server_port !~ 443){
        rewrite ^(/.*)$ https://$host$1 permanent;
    }
    #HTTP_TO_HTTPS_END
    ssl_certificate    /www/server/panel/vhost/cert/rencai.jiangzi.xin/fullchain.pem;
    ssl_certificate_key    /www/server/panel/vhost/cert/rencai.jiangzi.xin/privkey.pem;
    ssl_protocols TLSv1.1 TLSv1.2 TLSv1.3;
    ssl_ciphers EECDH+CHACHA20:EECDH+CHACHA20-draft:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;
    ssl_prefer_server_ciphers on;
    ssl_session_cache shared:SSL:10m;
    ssl_session_timeout 10m;
    add_header Strict-Transport-Security "max-age=31536000";
    error_page 497  https://$host$request_uri;

    #SSL-END

    #ERROR-PAGE-START  错误页配置，可以注释、删除或修改
    #error_page 404 /404.html;
    #error_page 502 /502.html;
    #ERROR-PAGE-END

    #PHP-INFO-START  PHP引用配置，可以注释或修改
    include enable-php-56.conf;
    #PHP-INFO-END

    #REWRITE-START URL重写规则引用,修改后将导致面板设置的伪静态规则失效
    include /www/server/panel/vhost/rewrite/rencai.jiangzi.xin.conf;
    #REWRITE-END

    #禁止访问的文件或目录
    location ~ ^/(\.user.ini|\.htaccess|\.git|\.env|\.svn|\.project|LICENSE|README.md)
    {
        return 404;
    }

    #一键申请SSL证书验证目录相关设置
    location ~ \.well-known{
        allow all;
    }

    #禁止在证书验证目录放入敏感文件
    if ( $uri ~ "^/\.well-known/.*\.(php|jsp|py|js|css|lua|ts|go|zip|tar\.gz|rar|7z|sql|bak)$" ) {
        return 403;
    }

    location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
    {
        expires      30d;
        error_log /dev/null;
        access_log /dev/null;
    }

    location ~ .*\.(js|css)?$
    {
        expires      12h;
        error_log /dev/null;
        access_log /dev/null;
    }
    access_log  /www/wwwlogs/rencai.jiangzi.xin.log;
    error_log  /www/wwwlogs/rencai.jiangzi.xin.error.log;
}
~~~

### nginx 伪静态配置
~~~
# yii2.0 高级模板伪静态
# 前端分离

# 后台管理
location /admin {
    try_files $uri $uri/ /admin/index.php?$query_string;
}


location /mobile {
  try_files  $uri /mobile/index.html?$args;
}


location /pc {
  try_files  $uri /pc/index.html?$args;
}


# api接口

location /api {
  if ($request_method = 'OPTIONS') {
            add_header Access-Control-Allow-Origin '*';
            add_header Access-Control-Allow-Headers 'token';
			 add_header Content-Length 0;
            return 204;
        }

 try_files $uri $uri/ /api/index.php?$query_string;
}

~~~