Nginx cannot access Swagger after deployment
Provide 2 methods, the first one is preferred
(1) Add the configuration directly to the.yml configuration file
springfox:
documentation:
swagger:
v2:
host: ip:8080
Copy the code
(2) The Nginx proxy forwards swagger-ui.html related paths
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;
}
Copy the code