以下是在Debian环境下部署Swagger的几种常见方法:
sudo apt update,sudo apt install nginx。wget下载相关文件。sudo mkdir -p /var/www/swagger-ui,然后复制下载的文件到该目录。/etc/nginx/sites-available/default,添加相关配置,如location /swagger-ui/部分。sudo systemctl restart nginx。http://<your-debian-ip>/swagger-ui/。sudo apt update,sudo apt install docker.io。docker pull swaggerapi/swagger-ui。docker run -p 8080:8080 -d swaggerapi/swagger-ui。http://<your-debian-ip>:8080。sudo apt update,sudo apt install spring-boot-devtools。pom.xml中添加Swagger依赖:<dependency><groupId>io.springfox</groupId><artifactId>springfox-boot-starter</artifactId><version>3.0.0</version></dependency>。@Configuration和@EnableSwagger2注解,配置Docket Bean。http://localhost:8080/swagger-ui.html查看Swagger UI。