在 Debian 上“调试 Swagger”通常分几种情况,你指的是哪一种会影响具体做法。下面我按最常见场景给你一套实用思路,你可以对号入座。
sudo netstat -tlnp | grep <端口>
# 或
ss -tlnp | grep <端口>
Swagger UI 常见端口:
如果是 Nginx:
sudo tail -f /var/log/nginx/error.log
sudo tail -f /var/log/nginx/access.log
如果是 Apache:
sudo tail -f /var/log/apache2/error.log
swagger.json确认:
springdoc:
swagger-ui:
enabled: true
访问:
http://<ip>:8080/swagger-ui.html
或
/v3/api-docs
调试命令:
journalctl -u your-service -f
app.config['SWAGGER'] = {'title': 'API'}
Swagger(app)
访问:
http://localhost:5000/apidocs/
常见原因:
@Operation / @Api)调试方法:
curl http://localhost:8080/v3/api-docs
如果 JSON 是空的 → 后端问题
如果 JSON 有但 UI 空 → 前端/CORS 问题
sudo ufw status
sudo iptables -L
getenforce
date
openssl x509 -in cert.pem -text -noout
curl http://localhost:端口/v3/api-docs如果你愿意,可以告诉我:
cat /etc/os-release)我可以直接给你针对你环境的调试命令。