安装部署
快速安装步骤
- 将项目文件解压到 Web 目录
- 配置
.env文件设置数据库 - 确保运行时目录可写
- 启动 Web 服务器
- 访问后台进行初始化设置
1. 配置数据库
编辑项目根目录 .env 文件:
# 使用 SQLite(推荐,零配置)
DB_DRIVER = sqlite
# 或使用 MySQL
DB_DRIVER = mysql
DB_HOST = 127.0.0.1
DB_NAME = yfcms
DB_USER = root
DB_PASS = your_password
DB_PORT = 3306
DB_PREFIX = yf_
2. 目录权限
确保以下目录可写:
| 目录 | 用途 | 权限 |
|---|---|---|
| runtime/ | 运行时缓存、日志 | 可写 |
| uploads/ | 上传文件存储 | 可写 |
| database/ | SQLite数据库文件 | 可写 |
3. 启动服务器
方式一:PHP内置服务器(开发环境)
php -S 127.0.0.1:8088 -t public public/router.php
方式二:Nginx配置
server {
listen 80;
server_name your-domain.com;
root /path/to/yfcms/public;
index index.php;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
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;
}
}
方式三:Apache
项目已包含 public/.htaccess 文件,直接配置即可。
4. 访问系统
| 页面 | URL |
|---|---|
| 前台首页 | http://your-domain.com/ |
| 后台管理 | http://your-domain.com/admin.php/admin/user/login |
| 功能演示 | http://your-domain.com/Demo |
| 使用向导 | http://your-domain.com/Guide |
默认管理员账号
用户名: admin 密码: 123123
首次登录后请立即修改密码!
生产环境注意
1. 设置 APP_DEBUG = false
2. 设置 APP_DEMO_ENABLED = false(关闭演示页面)
3. 替换 ENCRYPT_KEY 为随机32+字符