Nginx 配置访问 swagger 页面

假设SpringBoot 的应用部署在 http://192.168.1.15:8093 上, nginx.conf配置文件里面增加如下配置

location ~^/swagger/(.*)
{
proxy_redirect off;
# proxy_set_header Host host;proxysetheaderHosthost:server_port; #添加:server_port
proxy_set_header X-Real-IP remoteaddr;proxysetheaderXForwardedForproxy_add_x_forwarded_for;
proxy_pass http://192.168.1.15:8093/$1;
}
1
2
3
4
5
6
7
8
9
重新加载 nginx 配置

./nginx -s reload
1
访问 swagger 的地址为:

http://192.168.1.15:8093/swagger/swagger-ui.html
————————————————

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。

原文链接:https://blog.csdn.net/gzt19881123/article/details/105486882

posted @   GaoYanbing  阅读(423)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 分享4款.NET开源、免费、实用的商城系统
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
历史上的今天:
2023-03-21 WindTerm
2023-03-21 Linux操作系统之tcpdump抓包工具详解
2023-03-21 Homebrew国内如何自动安装(国内地址)(Mac & Linux)
点击右上角即可分享
微信分享提示