解決服務器部署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