サーバーがNginxをデプロイした後、Swaggerにアクセスできないという問題を解決します

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;
}

おすすめ

転載: blog.csdn.net/weixin_43438052/article/details/113989712