使用Nginx搭建Swagger

引言:网上所有关于swagger搭建的教程都是基于Node,步骤繁琐,容易失败。而且Node作为服务器,占用资源比Nginx多很多倍,速度不如nginx。因此尝试了用nginx去搭建swagger,十分简单,以Ubuntu为例。

安装nginx

yangbt@Ubuntu:~$sudo apt-get install nginx

下载swagger editor:https://github.com/swagger-api/swagger-editor
下载swagger ui: https://github.com/swagger-api/swagger-ui

nginx的html目录默认在/usr/share/nginx/html
将swagger-editor拷贝到html目录
将swagger-ui下的dist目录拷贝到html目录

好了,可以分别通过http://localhost/swagger-editor和http://localhost/swagger-ui访问了。
是不是很简单

posted @ 2017-07-10 10:27  丐帮杨公子  阅读(2123)  评论(0编辑  收藏  举报