![5c60220f7977c30f5531309dcbbc53c5.png](https://i-blog.csdnimg.cn/blog_migrate/eba4eb8df79e9067456b20aa5c741bc2.jpeg)
ApiAdmin4.0+ApiAdmin-WEB4.0 安装
- create 2019-09-28
- modified 2020-06-23
- by 广州-php-Stefan阿钢
ApiAdmin
- https://gitee.com/apiadmin/ApiAdmin/
# 克隆与初始
git clone https://gitee.com/apiadmin/ApiAdmin.git
cd ApiAdmin
composer install
# 手动创建数据库 apiadmin
# CREATE DATABASE IF NOT EXISTS apiadmin DEFAULT CHARSET utf8mb4 COLLATE utf8mb4_general_ci;
php think apiadmin:install --db mysql://root:123456@127.0.0.1:3306/apiadmin#utf8mb4
# 注意:检查 config/apiadmin.php 文件是否创建成功,如不存在,config目录开可写权限,删除 application/install/lock.ini 文件,再执行一次install
php think migrate:run
- ApiAdmin/application/install/lock.ini 有账号密码
- ApiAdmin/config/database.php 数据库配置
# ApiAdmin/config/cache.php 没redis改 type 值为 file
vim ApiAdmin/application/command/Install.php
// 注释掉Redis扩展判断
// if (!extension_loaded('redis')) {
// $output->highlight('缺少Redis扩展!');
// exit;
// }
设置nginx
server {
listen 80;
root /path/ApiAdmin/public;
index index.php index.html index.htm;
server_name api.apiadmin.test;
if (!-e $request_filename) {
rewrite ^/(.*)$ /index.php?s=/$1 last;
break;
}
location ~ .php {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
修改/etc/hosts
127.0.0.1 api.apiadmin.test
访问 http://api.apiadmin.test/api 返回如下则成功
{
"code": 1,
"msg": "操作成功",
"data": {
"Product": "ApiAdmin",
"Version": "v4.0",
"Company": "ApiAdmin开发维护团队",
"ToYou": "I'm glad to meet you(终于等到你!)"
},
"debug": [{
"TpVersion": "5.1.39 LTS",
"Float": "17793106597"
}]
}
ApiAdmin-WEB
- https://gitee.com/apiadmin/ApiAdmin-WEB
git clone https://gitee.com/apiadmin/ApiAdmin-WEB
cd ApiAdmin-WEB
- ApiAdmin-WEB/src/config/index.js 改api路径
baseUrl: {
dev: 'http://api.apiadmin.test/', // 开发环境
pro: 'https://api.apiadmin.org/' // 生产环境
},
node -v #>=8.9
npm -v #>= 3.0.0
npm install --registry=https://registry.npm.taobao.org
npm run dev
ApiAdmin-Element
- https://gitee.com/apiadmin/ApiAdmin-Element
git clone https://gitee.com/apiadmin/ApiAdmin-Element.git
cd ApiAdmin-Element
- .env.development中的VUE_APP_BASE_API修改为后台接口地址
npm install --registry=https://registry.npm.taobao.org
npm run dev
以下为 ApiAdmin 功能分解,供学习用,有兴趣可以看看
后端ThinkPHP51项目 - https://github.com/bstdn/ApiAdmin-ThinkPHP
前端iView项目 - https://github.com/bstdn/ApiAdmin-iView
前端Element项目 - https://github.com/bstdn/ApiAdmin-Element
搭建php环境 - 需要 php+mysql+nginx+redis - windows,可以使用 PhpStudy
Mac等可使用docker搭建环境 - https://github.com/bstdn/dockerfile/tree/master/dnmp
- 顺便给个Star 谢谢~
一键安装 ApiAdmin 上线~
- ApiAdmin-DNMP (ApiAdmin + Docker + Nginx + MySQL + PHP7 + Redis)
- https://gitee.com/bstdn/apiadmin-dnmp
- 或
- https://github.com/bstdn/apiadmin-dnmp
- 顺手 star~