diff --git a/deploy/nginx-api-upload.conf b/deploy/nginx-api-upload.conf new file mode 100644 index 0000000..503bde8 --- /dev/null +++ b/deploy/nginx-api-upload.conf @@ -0,0 +1,7 @@ +# 反代到 Spring Boot 时加入(server 或 location /api/ 内) +# 默认 client_max_body_size 仅 1m,会导致大视频返回 HTTP 413,小程序提示「文件过大」 + +client_max_body_size 200m; +proxy_connect_timeout 300s; +proxy_send_timeout 300s; +proxy_read_timeout 300s; diff --git a/src/main/resources/application-example.yml b/src/main/resources/application-example.yml new file mode 100644 index 0000000..b906372 --- /dev/null +++ b/src/main/resources/application-example.yml @@ -0,0 +1,46 @@ +# 复制为 application.yml 后填写本地/生产配置(application.yml 已加入 .gitignore,勿提交密钥) +spring: + application: + name: petstore-backend + datasource: + url: jdbc:mysql://127.0.0.1:3306/petstore?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai&autoReconnect=true + username: root + password: ${MYSQL_PASSWORD:changeme} + driver-class-name: com.mysql.cj.jdbc.Driver + hikari: + max-lifetime: 1800000 + connection-test-query: SELECT 1 + validation-timeout: 3000 + idle-timeout: 600000 + jpa: + hibernate: + ddl-auto: update + show-sql: true + properties: + hibernate: + dialect: org.hibernate.dialect.MySQLDialect + format_sql: true + servlet: + multipart: + max-file-size: 200MB + max-request-size: 200MB + +server: + port: 8080 + servlet: + context-path: + tomcat: + max-http-form-post-size: 200MB + max-swallow-size: 200MB + +upload: + path: uploads + +logging: + level: + com.petstore: debug + +wechat: + appid: ${WECHAT_APPID:} + appsecret: ${WECHAT_APPSECRET:} + redirect_uri: http://localhost:8080/api/wechat/callback diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 8bbc528..53f9005 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -21,13 +21,17 @@ spring: format_sql: true servlet: multipart: - max-file-size: 120MB - max-request-size: 120MB + max-file-size: 200MB + max-request-size: 200MB server: port: 8080 servlet: context-path: + # 与 multipart 一致,避免嵌入式 Tomcat 仍限制表单体积导致大视频 413 + tomcat: + max-http-form-post-size: 200MB + max-swallow-size: 200MB upload: path: /www/petstore/uploads