springboot整合vue部署在服务器上,上传文件跟回显文件有误,文件上传显示上传成功,但是文件不正常回显。正常在本地是正常回显的,
##这是nginx的代理配置 /api代理的是9090端口
server {
listen 81;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root /home/MyVueSpringboot/dist;
index index.html index.htm;
try_files $uri $uri/ /index.html;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
location /api/ {
proxy_pass http://localhost:9090/;
}
这里显示说我从9090端口获得图片有误
GET http://xx:9090/files/571e6b4893f1425cb1bb0c2efcdb9617 net::ERR_CONNECTION_TIMED_OUT
这里我上传一张照片
我觉得是vue在写文件上传时可能地址写死了,但
export default {
name: "Person",
data() {
return {
form: {},
filesUploadUrl: "http://" + window.server.filesUploadUrl + ":9090/files/upload"
}
},
可以在生产环境,拿到正式的图片地址,看能直接访问不?