webssh Sshwifty安装

官网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;
        }
    }
  • 10
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值