解决spring boot swagger ui使用 nginx 部署后无法使用问题

spring boot 使用 swagger ui做接口文档, 本地测试没有问题,但是部署到linux上时,

访问域名,就会得到如下结果:

解决spring boot swagger ui使用 nginx 部署后无法使用问题_第1张图片

解决办法:

修改nginx配置文件: nginx/conf.d/default.conf

原文件:
 

server {
    listen       80;
    server_name  quanke.name;
 
    location / {
        proxy_pass http://127.0.0.1:3101;
    }
 
}

修改为:

server {
    listen       80;
    server_name  quanke.name;
 
    location / {
        proxy_pass http://127.0.0.1:3101;
        proxy_set_header Host $host; # 指定host
    }
}

 

你可能感兴趣的:(SpringBoot开发,java,nginx,springboot)