15 Star 29 Fork 6

kzeng / yii2-cms

加入 Gitee
与超过 800 万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
yii
Loading...
README.md

Yii2 CMS

一款基于YII2框架的内容管理系统

安装

安装Yii2 CMS

  1. 通过Git安装
```bash
cd /var/www/
git clone https://git.oschina.net/kzeng/yii2-cms.git mysite.com
```
  1. 初始化

    执行 init 命令,然后选择 dev or prod 环境.

    cd /var/www/mysite.com/
    php init
  2. 配置Web服务器:

    Apache 服务器参考配置如下:

    <VirtualHost *:80>
      ServerName mysite.com
      ServerAlias www.mysite.com
      DocumentRoot "/var/www/mysite.com/"
      <Directory "/var/www/mysite.com/">
        AllowOverride All
        Order deny,allow
        Allow from all
        Require all granted
      </Directory>
    </VirtualHost>

    Nginx 服务器参考配置如下:

    server {
        charset      utf-8;
        client_max_body_size  200M;
        listen       80;
    
        server_name  mysite.com;
        root         /var/www/mysite.com;
    
        location / {
            root  /var/www/mysite.com/frontend/web;
            try_files  $uri /frontend/web/index.php?$args;
    
            # avoiding processing of calls to non-existing static files by Yii
            location ~ \.(js|css|png|jpg|gif|swf|ico|pdf|mov|fla|zip|rar)$ {
                access_log  off;
                expires  360d;
                try_files  $uri =404;
            }
        }
    
        location /admin {
            alias  /var/www/mysite.com/backend/web;
            rewrite  ^(/admin)/$ $1 permanent;
            try_files  $uri /backend/web/index.php?$args;
        }
    
        # avoiding processing of calls to non-existing static files by Yii
        location ~ ^/admin/(.+\.(js|css|png|jpg|gif|swf|ico|pdf|mov|fla|zip|rar))$ {
            access_log  off;
            expires  360d;
    
            rewrite  ^/admin/(.+)$ /backend/web/$1 break;
            rewrite  ^/admin/(.+)/(.+)$ /backend/web/$1/$2 break;
            try_files  $uri =404;
        }
    
        location ~ \.php$ {
            include  fastcgi_params;
            # check your /etc/php5/fpm/pool.d/www.conf to see if PHP-FPM is listening on a socket or port
            fastcgi_pass  unix:/var/run/php5-fpm.sock; ## listen for socket
            #fastcgi_pass  127.0.0.1:9000; ## listen for port
            fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
            try_files  $uri =404;
        }
        #error_page  404 /404.html;
    
        location = /requirements.php {
            deny all;
        }
    
        location ~ \.(ht|svn|git) {
            deny all;
        }
    }
  3. 创建一个新数据库,调整components['db']配置在common/config/main-local.php.

  4. 在控制台执行迁徙命令

 php yii migrate --migrationLookup=@yeesoft/yii2-yee-core/migrations/,@yeesoft/yii2-yee-auth/migrations/,@yeesoft/yii2-yee-settings/migrations/,@yeesoft/yii2-yee-menu/migrations/,@yeesoft/yii2-yee-user/migrations/,@yeesoft/yii2-yee-translation/migrations/,@yeesoft/yii2-yee-media/migrations/,@yeesoft/yii2-yee-post/migrations/,@yeesoft/yii2-yee-page/migrations/,@yeesoft/yii2-comments/migrations/,@yeesoft/yii2-yee-comment/migrations/,@yeesoft/yii2-yee-seo/migrations/

增强contact 联系我们模块功能,把数据记到contact_form表中,迁徙命令:

php yii migrate --migrationPath=@frontend/migrations/
  1. 在控制台创建一个root user: php yii init-admin.

  2. 配置 ['components']['mailer']common/config/main-local.php 中.

          'mailer' => [
              'class' => 'yii\swiftmailer\Mailer',    
              'useFileTransport' => false,
              'transport' => [
                  'class' => 'Swift_SmtpTransport',
                  'host' => 'smtp.qq.com',
                  'username' => 'zengkai001@qq.com',
                  'password' => 'jfpvkrfwcopibgdb',
                  'port' => '465',
                  'encryption' => 'ssl',
              ],
              'messageConfig' => [
                  'charset' => 'UTF-8',
                  'from' => ['zengkai001@qq.com'=>'admin'],
              ],
  
              'htmlLayout' => '@vendor/yeesoft/yii2-yee-auth/views/mail/layouts/html',
              'textLayout' => '@vendor/yeesoft/yii2-yee-auth/views/mail/layouts/text',
          ],

其中username为邮箱账号。邮箱账号必须开启SMTP。password是SMTP授权码,不是邮箱账号密码!!!

  1. 访问前台:mysite.com 访问后台:mysite.com/admin

已解决的问题

1. 后台Carousel(轮播图)管理模块,上传图片功能需完善。

2. tinymce中文化及定制开发与使用。

3. 轮播图中文件上传组件需改进,可参考post中缩略图上传组件的使用,应考虑图片素材一个网站内共用和统一管理

4. contact(联系我们)功能需完善, 建表需用migrate

5. 本地化,待完善

待解决的问题

  1. 后台自定义字段模块,怎么用?
  2. 后台HTML Block模块,怎么用?
  3. yii2-oauth,怎么用?怎么把社交帐号登录集成进来?
  4. 已完成功能模块需规范,composer打包机制?
  5. yee-gii的用法
  6. 打造一套或多套门户网站风格前端layout+view

简介

一款基于Yii2框架的内容管理系统,提供开箱即用功能。 展开 收起
PHP
MIT
取消

发行版

暂无发行版

yii2-cms

贡献者

全部

近期动态

加载更多
不能加载更多了
PHP
1
https://gitee.com/kzeng/yii2-cms.git
git@gitee.com:kzeng/yii2-cms.git
kzeng
yii2-cms
yii2-cms
master

搜索帮助