# 安装教程 #### 一、ape博客推荐你使用阿里云和腾讯云服务器 阿里云服务器官方长期折扣优惠地址: 点击访问,([https://www.aliyun.com/daily-act/ecs/activity_selection?userCode=dery8ymr](https://www.aliyun.com/daily-act/ecs/activity_selection?userCode=dery8ymr)) 腾讯云服务器官方长期折扣优惠地址: 点击访问,([https://curl.qcloud.com/G8kYi1YB](https://curl.qcloud.com/G8kYi1YB)) 服务器最低配置: ```auto 1核CPU (建议2核+) 2G内存 (建议4G+) 2M带宽 (建议5M+) ``` #### 二、服务器运行环境要求 ```auto PHP >= 7.1 Mysql >= 5.5.0 (需支持innodb引擎) Apache 或 Nginx PDO PHP Extension MBstring PHP Extension CURL PHP Extension Composer (用于管理第三方扩展包) ``` #### 三、系统安装 **方式一:完整包安装** 第一步:前往官网博客下载页面 ([https://gitee.com/muziys/apeblog/releases](https://gitee.com/muziys/apeblog/releases)) 下载完整包解压到你的项目目录 第二步:添加虚拟主机并绑定到项目的public目录 第三步:访问 [http://www.yoursite.com/install/index](http://www.yoursite.com/install/index) 进行安装 **方式二:命令行安装(推荐)** 推荐使用命令行安装,因为采用命令行安装的方式可以和勾股blog随时保持更新同步。使用命令行安装请提前准备好`Git`、`Composer`。 **Linux下,勾股blog的安装请使用以下命令进行安装** 第一步:克隆ape博客到你本地 ```shell git clone https://gitee.com/gougucms/blog.git ``` 复制 第二步:进入目录 ```shell cd blog ``` 复制 第三步:下载PHP依赖包 composer install 第四步:添加虚拟主机并绑定到项目的public目录 实际部署中,确保绑定域名访问到的是public目录。 第五步:访问 [http://www.yoursite.com/install/index](http://www.yoursite.com/install/index) 进行安装 ⚠️ 注意:安装过程中,系统会自动创建数据库,请确保填写的数据库用户的权限可创建数据库,如果权限不足,请先手动创建空的数据库,然后填写刚创建的数据库名称和用户名也可完成安装。 🔺 提醒:安装过程中,如果进度条卡住,一般都是数据库写入权限或者安装环境配置问题,请注意检查。 ⚠️遇到解决不了的问题请到QQ群反馈:24641076(群一满),46924914(群二满),295256660(群三)。 ✅ PS:如需要重新安装,请删除目录里面 config/install.lock 的文件,即可重新安装。 #### 四、伪静态配置 **Nginx** 修改nginx.conf 配置文件 加入下面的语句。 ```shell location /admin/ { index index.php index.html index.htm; if (!-e $request_filename){ rewrite ^/admin/(.*)$ /admin.php?s=$1; } } location /api/ { index index.php index.html index.htm; if (!-e $request_filename){ rewrite ^/api/(.*)$ /api.php?s=$1; } } location / { index index.php index.html index.htm; if (!-e $request_filename){ rewrite ^/(.*)$ /index.php?s=$1 last; } } ``` **Apache** 把下面的内容保存为.htaccess文件放到应用入 public 文件的同级目录下。 ```shell Options +FollowSymlinks -Multiviews RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^admin/(.*)$ admin.php?s=$1; RewriteRule ^api/(.*)$ api.php?s=$1; RewriteRule ^(.*)$ index.php?s=$1 [L] ```