### 系統環境
* Linux 或 Windows (`推薦Linux`)
* PHP 7.1+
* Apache 或 Nginx (`推薦Nginx`)
* MySQL 5.6+
### 開發環境
* Git客戶端
* Composer
### 安裝過程
#### 1. 下載源碼
Gitee倉庫
```bash
git clone https://gitee.com/fusionsdk/fusionaas.git
```
或 Github倉庫
```bash
git clone https://github.com/fusionsdk/fusionAAS.git
```
#### 2. 安裝PHP依賴庫
在項目的根目錄下(包含`think`文件的目錄),執行
```bash
composer install
```
#### 3. 數據庫安裝
在MySQL中創建數據庫,庫名建議為`fsdk_aas`
```bash
create database `fsdk_aas` default character set utf8mb4 collate utf8mb4_unicode_ci;
```
導入`sql\fsdk_aas.sql`文件進入數據庫中
```bash
mysql -u root -p fsdk_aas < ./sql/fsdk_aas.sql
```
#### 4. 系統配置
將`data/config/database.php-sample`文件復制到同目錄下,命名為`database.php`,修改其中相關數據庫連接參數。
### HTTP服務器配置
本系統支持Apache服務器或Nginx服務器,具體安裝過程請到相關官網查看。
#### Apache服務器配置
以下為虛擬主機配置文件`conf/extra/httpd-vhosts.conf`中的站點定義
```
<VirtualHost *:80>
ServerName localhost
DocumentRoot /your_site_save_path/fusionaas/public
<Directory "/your_site_save_path/fusionaas/public/">
Options FollowSymLinks ExecCGI
AllowOverride All
Order allow,deny
Allow from all
Require all granted
</Directory>
</VirtualHost>
```
#### Nginx服務器配置(推薦)
以下為虛擬主機配置文件`/etc/nginx/conf.d/your_site.conf`中的站點定義
```
server {
listen 80;
server_name localhost;
root /your_site_save_path/fusionaas/public;
location / {
index index.php index.html index.htm;
if (!-e $request_filename)
{
#地址作為將參數rewrite到index.php上。
rewrite ^/(.*)$ /index.php?s=$1;
#若是子目錄則使用下面這句,將subdir改成目錄名稱即可。
#rewrite ^/public/(.*)$ /public/index.php?s=$1;
}
}
location /api/ {
index index.php index.html index.htm;
if (!-e $request_filename)
{
#地址作為將參數rewrite到index.php上。
#rewrite ^/(.*)$ /api.php?s=$1;
#若是子目錄則使用下面這句,將subdir改成目錄名稱即可。
rewrite ^/api/(.*)$ /api.php?s=$1;
}
}
#proxy the php scripts to php-fpm
location ~ \.php {
include fastcgi_params;
set $path_info "";
set $real_script_name $fastcgi_script_name;
if ($fastcgi_script_name ~ "^(.+?\.php)(/.+)$") {
set $real_script_name $1;
set $path_info $2;
}
fastcgi_param SCRIPT_FILENAME $document_root$real_script_name;
fastcgi_param SCRIPT_NAME $real_script_name;
fastcgi_param PATH_INFO $path_info;
fastcgi_intercept_errors on;
fastcgi_pass 127.0.0.1:9000;
}
location ^~ /data/runtime {
return 404;
}
location ^~ /application {
return 404;
}
location ^~ /simplewind {
return 404;
}
}
```