解决服务器部署Nginx后不能访问Swagger

发布于个人的CSDN:https://blog.csdn.net/weixin_43438052/article/details/113989712

Nginx部署后不能访问Swagger

提供2中方法,优先选择第一种

(1) .yml 配置文件中直接添加配置

springfox:
  	documentation:
    	swagger:
      		v2:
        		host: ip:8080

(2) Nginx代理转发swagger-ui.html相关路径

location /swagger-ui.html {
    proxy_pass http://ip:port;
    index  index.html index.htm;
}

location /webjars {
	proxy_pass http://ip:port;
    index  index.html index.htm;
}

location /swagger-resources {
  proxy_pass http://ip:port;
  index  index.html index.htm;
}

location /v2 {
  proxy_pass http://ip:port;
  index  index.html index.htm;
}
posted @ 2021-02-23 15:05  MelodyJerry  阅读(1803)  评论(0编辑  收藏  举报
没有伞的孩子必须努力奔跑!|
载入天数...载入时分秒...
(っ•̀ω•́)っ✎⁾⁾ 开心每一天