Files
AIclinicalresearch/redcap-docker-dev/config/apache/redcap.conf
HaHafeng 38d9bf99d6 feat(redcap): REDCap 15.8.0 Docker本地开发环境部署完成
核心成果:
- REDCap 15.8.0成功部署在Docker环境
- 登录功能正常,管理员账户: Admin/Admin123!
- MySQL 8.0 + PHP 8.1 + Apache 2.4环境验证通过

问题解决:
1. 修复ERR_CONTENT_DECODING_FAILED错误
   - 强制禁用Apache deflate模块
   - PHP配置关闭zlib.output_compression
   - 自动注释REDCap源码中的压缩设置

2. 修复Base URL配置错误
   - 更新redcap_config表中的redcap_base_url
   - 统一DocumentRoot与访问路径

3. 修复登录失败问题(CRLF污染)
   - 删除database.php末尾的PHP结束标签
   - 创建.gitattributes规范换行符
   - 验证REDCap官方源码无此问题

技术改进:
- 添加密码重置工具脚本
- 完善docker-entrypoint.sh启动脚本
- 创建详细的部署问题解决记录
- 建立PHP配置文件最佳实践

部署文档:
- REDCap本地Docker开发环境部署方案
- REDCap生产环境部署决策报告(ECS vs SAE)
- 部署问题解决记录(含根因分析)

下一步:
- Day 2: 开发REDCap API Adapter
- 实现与IIT Manager Agent的数据对接
2026-01-02 10:02:46 +08:00

127 lines
4.0 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# REDCap Apache虚拟主机配置
# 版本v1.0
# 日期2026-01-01
# 适用:开发/测试/生产环境
<VirtualHost *:80>
ServerName localhost
ServerAdmin admin@localhost
DocumentRoot /var/www/html/redcap
# ========== 目录配置 ==========
<Directory /var/www/html/redcap>
# 禁止目录浏览(安全)
Options -Indexes +FollowSymLinks
# 允许.htaccess覆盖
AllowOverride All
# 访问权限
Require all granted
# 默认首页
DirectoryIndex index.php index.html
</Directory>
# ========== 限制特定目录访问(安全) ==========
# 禁止直接访问temp目录
<Directory /var/www/html/redcap/temp>
Require all denied
</Directory>
# 禁止直接访问modules源码仅允许通过REDCap访问
<DirectoryMatch "^/var/www/html/redcap/modules/.*/.*\.php$">
Require all denied
</DirectoryMatch>
# ========== 日志配置 ==========
ErrorLog ${APACHE_LOG_DIR}/redcap-error.log
CustomLog ${APACHE_LOG_DIR}/redcap-access.log combined
# 日志级别开发环境info生产环境warn
LogLevel warn
# ========== 安全头(推荐) ==========
# 防止点击劫持
Header always set X-Frame-Options "SAMEORIGIN"
# 防止MIME类型嗅探
Header always set X-Content-Type-Options "nosniff"
# XSS保护
Header always set X-XSS-Protection "1; mode=block"
# Referrer策略
Header always set Referrer-Policy "strict-origin-when-cross-origin"
# ========== PHP配置覆盖 ==========
# 文件上传限制
php_value upload_max_filesize 32M
php_value post_max_size 32M
# 执行时间限制(数据导出需要)
php_value max_execution_time 300
php_value max_input_time 300
# 内存限制
php_value memory_limit 256M
# ========== 性能优化 ==========
# 启用gzip压缩暂时禁用解决浏览器解码问题
# <IfModule mod_deflate.c>
# AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/javascript application/json
# </IfModule>
# 浏览器缓存(静态资源)
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access plus 1 month"
ExpiresByType image/jpeg "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
ExpiresByType image/gif "access plus 1 month"
ExpiresByType text/css "access plus 1 week"
ExpiresByType application/javascript "access plus 1 week"
</IfModule>
</VirtualHost>
# ========== HTTPS配置生产环境 ==========
# 生产环境应启用HTTPS取消下方注释并配置SSL证书
# <VirtualHost *:443>
# ServerName redcap.yourdomain.com
# ServerAdmin admin@yourdomain.com
# DocumentRoot /var/www/html/redcap
#
# # SSL证书配置
# SSLEngine on
# SSLCertificateFile /etc/ssl/certs/redcap.crt
# SSLCertificateKeyFile /etc/ssl/private/redcap.key
# # 如有中间证书:
# # SSLCertificateChainFile /etc/ssl/certs/intermediate.crt
#
# # SSL安全配置
# SSLProtocol all -SSLv2 -SSLv3 -TLSv1 -TLSv1.1
# SSLCipherSuite HIGH:!aNULL:!MD5:!3DES
# SSLHonorCipherOrder on
#
# # HSTS强制HTTPS
# Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains"
#
# # 其他配置同上Directory、Log等
# <Directory /var/www/html/redcap>
# Options -Indexes +FollowSymLinks
# AllowOverride All
# Require all granted
# </Directory>
#
# ErrorLog ${APACHE_LOG_DIR}/redcap-ssl-error.log
# CustomLog ${APACHE_LOG_DIR}/redcap-ssl-access.log combined
# </VirtualHost>
# ========== HTTP强制跳转HTTPS生产环境启用 ==========
# <VirtualHost *:80>
# ServerName redcap.yourdomain.com
# Redirect permanent / https://redcap.yourdomain.com/
# </VirtualHost>