通过 ttyd 实现网页 SSH,并且使用 cloudflare 打开代理,使支持 ipv4 和 ipv6,随时随地访问!
安装 ttyd
wget wget https://github.com/tsl0922/ttyd/releases/download/1.7.4/ttyd.x86_64 -O /usr/sbin/ttyd
chmod +x /usr/sbin/ttyd
新建服务
systemctl edit --force --full ttyd.service
粘贴以下内容,ctrl+x 点 y 回车保存退出
[Unit]
Description=ttyd
After=network.target[Service]
ExecStart=/usr/sbin/ttyd -W --ipv6 -c demo:196000.xyz -p 2086 login[Install]
WantedBy=multi-user.target设置自启
systemctl enable ttyd
systemctl start ttyd
systemctl status ttyd
反向代理
server {
listen 80; listen [::]:80; server_name blog.196000.xyz; location ~ ^/ttyd(.*)$ { proxy_http_version 1.1; proxy_set_header Host $host; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_pass http://127.0.0.1:27681/$1; }
}
- 域名访问
1 条评论
[...]解决 debain11上 ssh 连接慢问题systemctl mask systemd-logindpam-auth-update弹窗空格键取消 Register user sessions in the systemd control group hierarchy 的选择网页 ipv4/ipv6 随时随地 SSH[...]