首先备份一下nginx配置文件:

user www-data; worker_processes auto; pid /run/nginx.pid; include /etc/nginx/modules-enabled/*.conf;

events { worker_connections 1024; }

http { sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 65; types_hash_max_size 2048;

include /etc/nginx/mime.types; default_type application/octet-stream; gzip on;

设置SSL加密支持

server { listen 443 ssl; server_name status.l50.top;

ssl_certificate /root/l50.top.cer;
ssl_certificate_key /root/l50.top.key;

# 设置加密协议和加密套件
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers "EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH";
ssl_prefer_server_ciphers on;

# 添加SSL会话缓存和超时设置
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 60m;

location / {
    # 强制跳转到https
    if ($scheme != "https") {
        return 301 https://$server_name$request_uri;
    }
    
    proxy_pass http://127.0.0.1:8008;
    proxy_set_header Host $http_host;
    proxy_set_header      Upgrade $http_upgrade;
}
location ~ ^/(ws|terminal/.+)$  {
    proxy_pass http://127.0.0.1:8008;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "Upgrade";
    proxy_set_header Host $http_host;
}

}

设置80端口跳转到443端口

server { listen 80; server_name status.l50.top; return 301 https://$host$request_uri; } }

如果不这样操作,可能会因为nginx默认配置不支持ws协议而无法同步最新数据。就会出现同步失败!修改好了之后就可以正常使用了。