gongxiangp2/scripts/check-frp-server-remote.sh

64 lines
1.8 KiB
Bash

#!/bin/bash
# 在FRP服务器上执行的检查脚本
echo "=== FRP服务器信息 ==="
hostname
uname -a
echo ""
echo "=== 备份Nginx配置 ==="
mkdir -p /root/nginx-backup
BACKUP_NAME="nginx-$(date +%Y%m%d_%H%M%S)"
cp -r /etc/nginx /root/nginx-backup/$BACKUP_NAME 2>/dev/null
echo "备份完成: $BACKUP_NAME"
ls -la /root/nginx-backup/ | tail -3
echo ""
echo "=== 查找Nginx配置文件 ==="
find /etc/nginx -name "*.conf" -type f 2>/dev/null
echo ""
echo "=== 检查端口监听 ==="
netstat -tlnp 2>/dev/null | grep -E ':80|:443|:2320' || ss -tlnp 2>/dev/null | grep -E ':80|:443|:2320'
echo ""
echo "=== 查找3d.yydd.ai配置 ==="
grep -r "3d.yydd.ai" /etc/nginx/ 2>/dev/null || echo "未找到3d.yydd.ai配置"
echo ""
echo "=== 查看Nginx主配置 ==="
cat /etc/nginx/nginx.conf 2>/dev/null
echo ""
echo "=== 检查sites-enabled目录 ==="
ls -la /etc/nginx/sites-enabled/ 2>/dev/null || echo "sites-enabled目录不存在"
if [ -d /etc/nginx/sites-enabled ]; then
for file in /etc/nginx/sites-enabled/*; do
if [ -f "$file" ]; then
echo "--- $file ---"
cat "$file"
fi
done
fi
echo ""
echo "=== 检查FRPS服务 ==="
systemctl status frps 2>&1 | head -15 || ps aux | grep frps | grep -v grep
echo ""
echo "=== 检查FRPS配置文件 ==="
find /root -name "frps.toml" -o -name "frps.ini" 2>/dev/null | head -5
if [ -f /root/frps.toml ]; then
echo "--- /root/frps.toml ---"
cat /root/frps.toml
elif [ -f /etc/frp/frps.toml ]; then
echo "--- /etc/frp/frps.toml ---"
cat /etc/frp/frps.toml
fi
echo ""
echo "=== 检查SSL证书 ==="
find /etc -name "*.crt" -o -name "*.pem" 2>/dev/null | grep -E "ssl|cert|nginx" | head -10
ls -la /etc/letsencrypt/live/ 2>/dev/null || echo "未找到letsencrypt证书"
ls -la /etc/nginx/ssl/ 2>/dev/null || echo "未找到nginx ssl目录"