官网https://github.com/nirui/sshwifty
docker安装
拉取镜像
##对docker版本有要求
docker pull niruix/sshwifty:latest
启动
docker run --detach --restart always --publish 8182:8182 --env SSHWIFTY_DOCKER_TLSCERT="$(cat domain.crt)" --env SSHWIFTY_DOCKER_TLSCERTKEY="$(cat domain.key)" --name sshwifty niruix/sshwifty:latest
SSHWIFTY_DOCKER_TLSCERT和SSHWIFTY_DOCKER_TLSCERTKEY为自己的https证书若没有证书
openssl req -newkey rsa:4096 -nodes -keyout domain.key -x509 -days 90 -out domain.crt
下载tar包安装
mkdir sshwifty
cd sshwifty
##找到对应版本下载地址
weget https://github.com/nirui/sshwifty/releases/download/0.3.10-beta-release-prebuild/sshwifty_0.3.10-beta-release_linux_amd64.tar.gz
tar -xf sshwifty_0.3.10-beta-release_linux_amd64.tar.gz
修改配置文件
vi sshwifty.conf.example.json
##修改SharedKey和ListenInterface
mv sshwifty.conf.example.json sshwifty.conf.json
##启动
./sshwifty_linux_amd64
nginx配置
##映射子目录
map $http_upgrade $connection_upgrade { default upgrade; '' close; }
http{
index index.html index.html;
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
upstream sshwifty_backend {
# Up stream Sshwifty backend server, change address accordingly
server 127.0.0.1:8182;
}
server{
listen 443 ssl;
location /sshwifty/socket {
# Proxy to the websocket interface, change address accordingly
proxy_pass http://sshwifty_backend/sshwifty/socket;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
}
# Notice that you have to redirect the request from /sshwifty/* to /sshclient/sshwifty/*
location ~ ^/sshwifty/assets/(.*) {
return 301 /sshclient/sshwifty/assets/$1;
}
location /sshclient/ {
rewrite ^/sshclient/(.*) /$1 break;
# Proxy to the landing page, change address accordingly
proxy_pass http://sshwifty_backend;
}
}
}
##映射主目录
location / {
proxy_pass http://172.0.0.1:8182;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
}
}