springboot本地开发资源路径正常,部署ngixn无法访问

springboot本地开发内置Tomcat 资源路径
http://localhost:8866/upload/... 访问正常

部署后,绑定域名后, 用的宝塔配置的
服务跑在服务器本地8866端口 使用ngixn反向代理接口

http://域名/upload/xxx.jpg 无法访问图片
http://ip:8866/upload/xxx.jpg 可以访问图片

请问下哪里需要配置呀?
搞半天搞不来呀
其他就是默认的宝塔里面的 ssl

 location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|ttf|woff|eot)$
    {
        expires      30d;
        error_log /dev/null;
        access_log /dev/null;
    }
    
    location ~ .*\.(js|css)?$
    {
        expires      12h;
        error_log /dev/null;
        access_log /dev/null; 
    }

        
     
        location / {
        root   /www/wwwroot/www.xxx.com/dist/; 
        try_files $uri $uri/ /index.html;
        index index.jsp index.html index.htm;
        }

          #接口地址
      location /api/ {
       proxy_pass http://127.0.0.1:8866/;
           proxy_connect_timeout 15s;
           proxy_send_timeout 15s;
           proxy_read_timeout 15s;
           proxy_set_header X-Real-IP $remote_addr;
           proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        }
阅读 2.4k
1 个回答

贴下你的nginx配置啊

补充回答:
看你的配置,你并没有针对upload这个目录做反向代理啊。你只是针对于/api/这个目录转发到了8866.

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题
宣传栏