Solve the problem that Swagger cannot be accessed after the server deploys Nginx

Cannot access Swagger after Nginx is deployed

Provide 2 methods, the first one is preferred

(1) Add configuration directly to the .yml configuration file

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

(2) Nginx proxy forwarding swagger-ui.html related path

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

Guess you like

Origin blog.csdn.net/weixin_43438052/article/details/113989712
Recommended