nginx 反代ws协议进行im在线聊天的 websocket协议

   location /im-api/ {
        proxy_redirect off;
        proxy_pass http://172.26.71.51:9218/;      # 转发
        proxy_set_header Host $host;
        proxy_set_header X-Real_IP $remote_addr;
        proxy_set_header X-Forwarded-For $remote_addr:$remote_port;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;   # 升级协议头 websocket
        proxy_set_header Connection upgrade;
          }

展开阅读剩余部分

linux定时任务执行

#!/bin/bash

# Define the directory where logs are stored
LOG_DIR="/data/scripts"

# Define the maximum file size in bytes (10GB = 10 * 1024 * 1024 * 1024)
MAX_SIZE=$((10*1024*1024*1024))

# Log file for recording execution logs
LOG_FILE="/var/log/cleanup_logs.log"

# Log the current date/time and action
echo "$(date +'%Y-%m-%d %H:%M:%S') - Starting log cleanup" >> "$LOG_FILE"

# Find and delete log files larger than MAX_SIZE bytes recursively
find "$LOG_DIR" -type f -name "*.log" -size +$MAX_SIZEc -print0 | while IFS= read -r -d '' file; do
    echo "$(date +'%Y-%m-%d %H:%M:%S') - Deleting $file" >> "$LOG_FILE"
    rm -f "$file"
done

# Log the completion
echo "$(date +'%Y-%m-%d %H:%M:%S') - Log cleanup completed" >> "$LOG_FILE"

展开阅读剩余部分