farwmarth

Those that can,do.Those that can't ,complain


  • 首页

  • 关于

  • 归档

  • 豆瓣

  • 音乐

  • 搜索
close

将内网终端分享给其他人使用

时间: 2017-01-05   |   阅读: 906 字 ~2分钟

起因是某人要学习下linux,但是不想用虚拟机装linux,在网上也找了几个在线的shell练习网站,感觉不是很满意,于是想把自己内网主机上的终端share一下,github搜索了一下还真有这样的项目.

ttyd

ttyd是一个把自己的终端通过web方式共享给其他人操作的工具

https://github.com/tsl0922/ttyd

sudo ttyd login
#默认端口是7681 用login方式要输入账号密码
#http://localhost:7681

ngrok

ngrok服务可以分配给你一个域名让你本地的web项目提供给外网访问,特别适合向别人展示你本机的web demo 以及调试一些远程的API.

  • qydev : http://qydev.com/

    ./ngrok -config=ngrok.cfg -hostname farwmarth 7681
    #http://farwmarth.tunnel.qydev.com/

ttyd

frp

frp 是一个高性能的反向代理应用,可以帮助您轻松地进行内网穿透,对外网提供服务,支持 tcp, udp, http, https 等协议类型,并且 web 服务支持根据域名进行路由转发

一键安装

wget --no-check-certificate https://raw.githubusercontent.com/clangcn/onekey-install-shell/master/frps/install-frps.sh -O ./install-frps.sh
chmod 700 ./install-frps.sh
./install-frps.sh install

frp配合ttyd的配置

#frpc.ini
[common]
server_addr = frp.lu8.win
server_port = 7000
log_file = ./frpc.log
log_level = info
log_max_days = 3
privilege_token = frp888

[http_mode]
#注意修改上方[]内的内容,不要与其他隧道名称重复
#privilege_mode特权模式
privilege_mode = true
type = http
#local_ip本地服务IP
local_ip = 127.0.0.1
#local_port本地服务端口
local_port = 7681
custom_domains = farwmarth.frp.lu8.win

frp配合nginx

域名解析到服务器frptest.xxx.com

服务器frp配置

[common]
    bind_addr = 0.0.0.0
    bind_port = 7000
    vhost_http_port = 5999

[frptest]
    type = http
    auth_token = xxx
    custom_domains = frptest.xxx.com

nginx配置

 upstream frptest{
     server 127.0.0.1:5999;
 }

 server
 {
     listen 80;
     server_name frptest.xxx.com;

     location / {
         proxy_pass http://frptest;
         proxy_http_version 1.1;
         proxy_read_timeout 7200;
         proxy_set_header Connection "";
         proxy_set_header Host $host;
         proxy_set_header X-Real-Ip $remote_addr;
         proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
     }
 }

客户端frp配置

[common]
    server_addr = 服务器ip
    server_port = 7000
    auth_token xxx
    log_file = ./frpc.log
    log_level = info
    log_max_days = 3

[frptest]
    local_ip = 127.0.0.1
    local_port = 8080
    type = http
    auth_token = xxx
    ```

### 用frp做ssh转发

时序图大致如下:

![](https://farwmarth.bestnewbee.com/14904631822511.jpg)


#### 外网服务器配置

shell #frps.ini [common] bind_addr = 0.0.0.0 bind_port = 7000 log_max_days = 7 max_pool_count = 100 log_file = frps.log log_level = info

[ssh] listen_port = 6000 type = tcp auth_token = 通讯加密token use_encryption = true use_gzip = true

#### 内网客户端配置
先要安装ssh服务开启并将端口设置为`22022`

shell #frpc.ini [common] server_addr = 外网服务器ip server_port = 7000 auth_token = 通讯加密token log_file = ./frpc.log log_level = info log_max_days = 3

[ssh] local_ip = 127.0.0.1 local_port = 22022 type = tcp use_gzip = true use_encryption = true

#### 本机连接

ssh -oPort=6000 内网客户端ssh用户@外网服务器ip

#### 外网服务器访问内网web服务

shell #frps.ini [common] bind_addr = 0.0.0.0 bind_port = 1234 log_max_days = 7 max_pool_count = 100 log_file = frps.log log_level = info vhost_http_port = 1235

[web] type = http auth_token = xxx custom_domains = xxx.xxx.com

shell #frpc.ini [common] server_addr = m1-test-pub2.m1.ejoy.com server_port = 1234 auth_token = xxx log_file = ./frpc.log log_level = info log_max_days = 3

[web] type = http local_port =10003 custom_domains = xxx.xxx.com ```

通过http://xxx.xxx.com:1235可以访问内网web服务

socket-pipe

node写的,直接看作者的介绍

  • https://joyqi.com/javascript/socket-pipe.html
  • https://github.com/joyqi/socket-pipe
#ttyd#
语音服务器的选型
初级运维指南
farwmarth

farwmarth

Programmer

104 日志
32 分类
93 标签
GitHub
© 2009 - 2021 farwmarth
Powered by - Hugo v0.58.2
Theme by - NexT
0%