解决服务器部署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;
}


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM