diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..945f2ab --- /dev/null +++ b/.dockerignore @@ -0,0 +1,14 @@ +.git +.gitignore +.env +.DS_Store +*.md +docker-compose.yml +Dockerfile +.dockerignore +node_modules +.vscode +.idea +*.log +runtime/* + diff --git a/.htaccess b/.htaccess new file mode 100644 index 0000000..0519ecb --- /dev/null +++ b/.htaccess @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/404.html b/404.html new file mode 100755 index 0000000..b51c408 --- /dev/null +++ b/404.html @@ -0,0 +1,74 @@ + + + + + + 404 Not Found + + + +
+ +
404
+
Sorry, the page you visited does not exist.
It may be that the access link is wrong or the file does not exist.
+ +
+ + diff --git a/502.html b/502.html new file mode 100755 index 0000000..82c9ef4 --- /dev/null +++ b/502.html @@ -0,0 +1,74 @@ + + + + + + 502 Bad Gateway + + + +
+ +
502
+
Gateway error.
The website server has timed out in returning data, please wait a few minutes and try again.
+ +
+ + diff --git a/DOCKER_README.md b/DOCKER_README.md new file mode 100644 index 0000000..895fc62 --- /dev/null +++ b/DOCKER_README.md @@ -0,0 +1,174 @@ +# Docker 部署说明 + +本项目使用 `webdevops/php-nginx:7.2-alpine` 作为基础镜像。 + +## 文件说明 + +- `Dockerfile` - Docker 镜像构建文件 +- `docker-compose.yml` - Docker Compose 编排文件 +- `.dockerignore` - Docker 构建忽略文件 +- `docker/nginx/vhost.conf` - Nginx 虚拟主机配置 + +## 快速启动 + +### 1. 安装依赖(首次部署) + +在启动 Docker 之前,需要先在宿主机上安装 Composer 依赖: + +```bash +composer install +``` + +### 2. 启动服务 + +```bash +docker-compose up -d +``` + +### 3. 查看服务状态 + +```bash +docker-compose ps +``` + +### 4. 查看日志 + +```bash +# 查看所有服务日志 +docker-compose logs -f + +# 查看 web 服务日志 +docker-compose logs -f web + +# 查看 MySQL 日志 +docker-compose logs -f mysql +``` + +## 服务信息 + +### Web 服务 +- 访问地址: http://localhost:8080 +- 容器名称: weipan_web +- PHP 版本: 7.2 +- Web 服务器: Nginx + +### MySQL 服务 +- 主机: mysql (容器内) / localhost:3306 (宿主机) +- 数据库: weipan +- 用户名: weipan +- 密码: weipan123 +- Root 密码: root + +## 配置说明 + +### PHP 配置 +- 内存限制: 256M +- 执行时间: 300秒 +- POST 大小: 50M +- 上传文件大小: 50M + +### 数据库配置 + +修改 `config/database.php` 中的数据库连接信息: + +```php +'hostname' => 'mysql', // Docker 容器内使用服务名 +'database' => 'weipan', +'username' => 'weipan', +'password' => 'weipan123', +``` + +## 常用命令 + +### 停止服务 + +```bash +docker-compose stop +``` + +### 重启服务 + +```bash +docker-compose restart +``` + +### 停止并删除容器 + +```bash +docker-compose down +``` + +### 停止并删除容器和数据卷 + +```bash +docker-compose down -v +``` + +### 重新构建镜像 + +```bash +docker-compose build --no-cache +docker-compose up -d +``` + +### 进入容器 + +```bash +# 进入 web 容器 +docker-compose exec web sh + +# 进入 MySQL 容器 +docker-compose exec mysql bash +``` + +### 清理缓存 + +```bash +docker-compose exec web php think clear +``` + +## 目录权限 + +如果遇到权限问题,可以在容器内执行: + +```bash +docker-compose exec web chown -R application:application /app +docker-compose exec web chmod -R 777 /app/runtime +``` + +## 生产环境建议 + +1. 修改 MySQL 密码为强密码 +2. 调整 `docker-compose.yml` 中的端口映射 +3. 设置合适的环境变量 +4. 配置数据卷备份策略 +5. 启用 HTTPS +6. 配置防火墙规则 + +## 故障排查 + +### 查看容器日志 + +```bash +docker-compose logs -f web +``` + +### 检查容器状态 + +```bash +docker-compose ps +``` + +### 测试数据库连接 + +```bash +docker-compose exec mysql mysql -uweipan -pweipan123 weipan +``` + +### 重置权限 + +```bash +docker-compose exec web chown -R application:application /app +docker-compose exec web chmod -R 755 /app +docker-compose exec web chmod -R 777 /app/runtime +``` diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..e217c80 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,35 @@ +FROM webdevops/php-nginx:7.2-alpine +# 设置工作目录 +WORKDIR /app +# 复制项目文件 +COPY . /app +# 复制 Nginx 配置文件 +COPY docker/nginx/enable-php.conf /opt/docker/etc/nginx/enable-php.conf +COPY docker/nginx/vhost.conf /opt/docker/etc/nginx/vhost.conf +# 复制自定义 entrypoint 脚本 +COPY docker/entrypoint.sh /usr/local/bin/custom-entrypoint.sh +# 给脚本添加可执行权限 +RUN chmod +x /app/public/start.sh && \ + chmod +x /usr/local/bin/custom-entrypoint.sh +# 设置项目文件为只读权限(除 runtime 目录外) +RUN chmod -R 555 /app +# 设置 runtime 目录和 .env 文件位置为可写权限 +RUN chmod -R 755 /app/runtime && \ + chmod 755 /app +# 复制 crontab 配置并安装 +COPY docker/crontab /tmp/crontab +RUN cat /tmp/crontab && \ + crontab -u application /tmp/crontab && \ + crontab -u application -l && \ + rm /tmp/crontab +# 设置环境变量 +ENV WEB_DOCUMENT_ROOT=/app/public \ + PHP_DISPLAY_ERRORS=0 \ + PHP_MEMORY_LIMIT=256M \ + PHP_MAX_EXECUTION_TIME=300 \ + PHP_POST_MAX_SIZE=50M \ + PHP_UPLOAD_MAX_FILESIZE=50M +# 声明容器对外暴露的端口 +EXPOSE 80 +# 设置自定义 entrypoint +ENTRYPOINT ["/usr/local/bin/custom-entrypoint.sh"] diff --git a/config/database.php b/config/database.php index 42d093e..f9ece82 100755 --- a/config/database.php +++ b/config/database.php @@ -13,7 +13,7 @@ // +---------------------------------------------------------------------- return [ // 数据库调试模式 - 'debug' => env('database.debug', true), + 'debug' => false, // 数据库类型 'type' => 'mysql', // 服务器地址 diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..5b05c58 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,23 @@ +version: '3.8' + +services: + web: + build: . + container_name: weipan_web + ports: + - "8080:80" + volumes: + - runtime_data:/app/runtime + environment: + # 数据库配置(用于生成 .env 文件) + - database_hostname=10.100.100.88 + - database_database=0302-2 + - database_username=0302-2 + - database_password=0302-2 + - database_charset=utf8mb4 + - database_hostport=65306 + network_mode: host + restart: unless-stopped + +volumes: + runtime_data: diff --git a/docker/crontab b/docker/crontab new file mode 100644 index 0000000..2fc0123 --- /dev/null +++ b/docker/crontab @@ -0,0 +1,5 @@ +# 每分钟执行 start.sh +* * * * * /bin/sh /app/public/start.sh >> /app/runtime/log/cron.log 2>&1 + +# 每分钟执行 think InterestTreasure +* * * * * cd /app && /usr/local/bin/php /app/think InterestTreasure >> /app/runtime/log/think.log 2>&1 diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh new file mode 100644 index 0000000..93b29c6 --- /dev/null +++ b/docker/entrypoint.sh @@ -0,0 +1,19 @@ +#!/bin/sh +set -e + +# 根据环境变量生成 .env 文件 +cat > /app/.env < + + + + Site is created successfully! + + + +
+

Congratulations, the site is created successfully!

+

This is the default index.html, this page is automatically generated by the system

+ +
+ + + \ No newline at end of file diff --git a/public/chatlink.html b/public/chatlink.html new file mode 100755 index 0000000..154d7fe --- /dev/null +++ b/public/chatlink.html @@ -0,0 +1,123 @@ + + + + + + + 在线咨询 + + + + + + \ No newline at end of file diff --git a/public/guoqi/1.png b/public/guoqi/1.png new file mode 100755 index 0000000..4102d7a Binary files /dev/null and b/public/guoqi/1.png differ diff --git a/public/guoqi/10.png b/public/guoqi/10.png new file mode 100755 index 0000000..c680f9e Binary files /dev/null and b/public/guoqi/10.png differ diff --git a/public/guoqi/11.png b/public/guoqi/11.png new file mode 100755 index 0000000..78eeef2 Binary files /dev/null and b/public/guoqi/11.png differ diff --git a/public/guoqi/12.png b/public/guoqi/12.png new file mode 100755 index 0000000..42f3b32 Binary files /dev/null and b/public/guoqi/12.png differ diff --git a/public/guoqi/13.png b/public/guoqi/13.png new file mode 100755 index 0000000..71cfe5f Binary files /dev/null and b/public/guoqi/13.png differ diff --git a/public/guoqi/14.png b/public/guoqi/14.png new file mode 100755 index 0000000..b7358f8 Binary files /dev/null and b/public/guoqi/14.png differ diff --git a/public/guoqi/1bnb.png b/public/guoqi/1bnb.png new file mode 100755 index 0000000..233225d Binary files /dev/null and b/public/guoqi/1bnb.png differ diff --git a/public/guoqi/2.png b/public/guoqi/2.png new file mode 100755 index 0000000..4333551 Binary files /dev/null and b/public/guoqi/2.png differ diff --git a/public/guoqi/2eth.png b/public/guoqi/2eth.png new file mode 100755 index 0000000..233225d Binary files /dev/null and b/public/guoqi/2eth.png differ diff --git a/public/guoqi/3.png b/public/guoqi/3.png new file mode 100755 index 0000000..1ceff60 Binary files /dev/null and b/public/guoqi/3.png differ diff --git a/public/guoqi/4.png b/public/guoqi/4.png new file mode 100755 index 0000000..3a6f398 Binary files /dev/null and b/public/guoqi/4.png differ diff --git a/public/guoqi/5.png b/public/guoqi/5.png new file mode 100755 index 0000000..7689639 Binary files /dev/null and b/public/guoqi/5.png differ diff --git a/public/guoqi/6.png b/public/guoqi/6.png new file mode 100755 index 0000000..52dea8c Binary files /dev/null and b/public/guoqi/6.png differ diff --git a/public/guoqi/7.png b/public/guoqi/7.png new file mode 100755 index 0000000..18920d5 Binary files /dev/null and b/public/guoqi/7.png differ diff --git a/public/guoqi/8.png b/public/guoqi/8.png new file mode 100755 index 0000000..346f83b Binary files /dev/null and b/public/guoqi/8.png differ diff --git a/public/guoqi/9.png b/public/guoqi/9.png new file mode 100755 index 0000000..4cbbf25 Binary files /dev/null and b/public/guoqi/9.png differ diff --git a/public/guoqi/BNB.png b/public/guoqi/BNB.png new file mode 100755 index 0000000..3964c85 Binary files /dev/null and b/public/guoqi/BNB.png differ diff --git a/public/guoqi/ERH.png b/public/guoqi/ERH.png new file mode 100755 index 0000000..6ab0854 Binary files /dev/null and b/public/guoqi/ERH.png differ diff --git a/public/guoqi/Gold.png b/public/guoqi/Gold.png new file mode 100755 index 0000000..233225d Binary files /dev/null and b/public/guoqi/Gold.png differ diff --git a/public/guoqi/HBGTRX.png b/public/guoqi/HBGTRX.png new file mode 100755 index 0000000..96e1ad0 Binary files /dev/null and b/public/guoqi/HBGTRX.png differ diff --git a/public/guoqi/ada.png b/public/guoqi/ada.png new file mode 100755 index 0000000..ce71424 Binary files /dev/null and b/public/guoqi/ada.png differ diff --git a/public/guoqi/bch.png b/public/guoqi/bch.png new file mode 100755 index 0000000..c824849 Binary files /dev/null and b/public/guoqi/bch.png differ diff --git a/public/guoqi/btc.png b/public/guoqi/btc.png new file mode 100755 index 0000000..b469cbd Binary files /dev/null and b/public/guoqi/btc.png differ diff --git a/public/guoqi/dash.png b/public/guoqi/dash.png new file mode 100755 index 0000000..08a9e17 Binary files /dev/null and b/public/guoqi/dash.png differ diff --git a/public/guoqi/doge.png b/public/guoqi/doge.png new file mode 100755 index 0000000..12acccf Binary files /dev/null and b/public/guoqi/doge.png differ diff --git a/public/guoqi/eos.png b/public/guoqi/eos.png new file mode 100755 index 0000000..11f6707 Binary files /dev/null and b/public/guoqi/eos.png differ diff --git a/public/guoqi/eth.png b/public/guoqi/eth.png new file mode 100755 index 0000000..689c04f Binary files /dev/null and b/public/guoqi/eth.png differ diff --git a/public/guoqi/iota.png b/public/guoqi/iota.png new file mode 100755 index 0000000..7c6484f Binary files /dev/null and b/public/guoqi/iota.png differ diff --git a/public/guoqi/ltc.png b/public/guoqi/ltc.png new file mode 100755 index 0000000..067ea9c Binary files /dev/null and b/public/guoqi/ltc.png differ diff --git a/public/guoqi/usdt.png b/public/guoqi/usdt.png new file mode 100755 index 0000000..db9202c Binary files /dev/null and b/public/guoqi/usdt.png differ diff --git a/public/guoqi/xrp.png b/public/guoqi/xrp.png new file mode 100755 index 0000000..5c55836 Binary files /dev/null and b/public/guoqi/xrp.png differ diff --git a/public/start.sh b/public/start.sh index 1a8a39b..f442ef7 100644 --- a/public/start.sh +++ b/public/start.sh @@ -1,8 +1,9 @@ +#!/bin/sh # 设置执行的持续时间(60秒 = 1分钟) -cd /www/wwwroot/weipan02_server/public -for i in {1..29} +cd /app/public +for i in $(seq 1 29) do php index.php /index/index/order php index.php /index/index/product sleep 1 -done \ No newline at end of file +done