排除法
先排除 是 jar 包 配置问题
wget http://127.0.0.1:8085/manage/profile/upload/2021/07/05/8bd8d97f-e4b9-467e-a020-c6da4b98ddff.png

nginx 配置
# 如果nginx有这个删除location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)${expires 30d;error_log off;access_log off;}
完整 nginx 配置
server{listen 80;server_name zh.demo.com;index index.php index.html index.htm default.php default.htm default.html;root /www/wwwroot/zh.demo.com;#SSL-START SSL相关配置,请勿删除或修改下一行带注释的404规则#error_page 404/404.html;#SSL-END#ERROR-PAGE-START 错误页配置,可以注释、删除或修改error_page 404 /404.html;error_page 502 /502.html;#ERROR-PAGE-END#PROXY-STARTlocation ~ /purge(/.*) {proxy_cache_purge cache_one $host$request_uri$is_args$args;#access_log /www/wwwlogs/zh.demo.com_purge_cache.log;}location /{if ( !-e $request_filename){proxy_pass http://127.0.0.1:8922;}}#PROXY-END#REWRITE-START URL重写规则引用,修改后将导致面板设置的伪静态规则失效include /www/server/panel/vhost/rewrite/zh.demo.com.conf;#REWRITE-END#禁止访问的文件或目录location ~ ^/(\.user.ini|\.htaccess|\.git|\.svn|\.project|LICENSE|README.md|\.jar){return 404;}#一键申请SSL证书验证目录相关设置location ~ \.well-known{allow all;}access_log /www/wwwlogs/zh.demo.com.log;error_log /www/wwwlogs/zh.demo.com.error.log;}
springboot资源配置
import org.springframework.beans.factory.annotation.Autowired;import org.springframework.context.annotation.Bean;import org.springframework.context.annotation.Configuration;import org.springframework.web.cors.CorsConfiguration;import org.springframework.web.cors.UrlBasedCorsConfigurationSource;import org.springframework.web.filter.CorsFilter;import org.springframework.web.servlet.config.annotation.InterceptorRegistry;import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;/*** 通用配置** @author admin*/@Configurationpublic class ResourcesConfig implements WebMvcConfigurer{@Autowiredprivate RepeatSubmitInterceptor repeatSubmitInterceptor;@Overridepublic void addResourceHandlers(ResourceHandlerRegistry registry){/** 本地文件上传路径 */registry.addResourceHandler("/profile/**").addResourceLocations("file:/usr/local/upload/demo/" );}}
