Comments (10)
运行Sshwifty服务器端的计算机有图中所指的接口么?如果没有的话操作系统会拒绝程序的绑定申请。
你可以在服务器上运行命令 ip a | grep "这里填写IP地址"
或 ifconfig | grep "这里填写IP地址"
来确认所填写的接口是存在的。
from sshwifty.
运行命令后无反应,那就应该是接口不存在。那我应该怎样做才能实现ip:端口
访问?
from sshwifty.
那么你可以用ip a
或者 ifconfig
命令查看系统里存在的接口,然后找到WAN上可以访问的,绑定那一个就可以了。
或者如果对安全没有顾虑,可以绑定0.0.0.0
,这样操作系统会自动绑定所有可用接口。
from sshwifty.
好的,感谢作者,解决了我的问题!
from sshwifty.
实在是打扰作者了,我又把这个issues打开了,我现在遇到的问题是使用ip:端口
可以运行sshwifty,但我也想实现像您的demo那样可以直接使用域名访问(因为想https访问只能绑定域名),我尝试Nginx反代,但我不知道root该填写什么,下面是我的配置文件,希望您给个思路。
我是直接wget下载的release中linux的tar.gz包然后sshwifty
运行的。
from sshwifty.
ListenInterface
选项绑定的不是URL地址,而是本地网卡的IP地址。选项的值与实际访问的URL,比如https://10.0.0.1:8182
并没有直接的对应关系。
root
选项不是必须的。反向代理用proxy_
这一系列选项就行了。可以参考下面的选项(你需要将一些设置改成适应自己运行环境的):
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
upstream sshwifty_backend {
server 127.0.0.1:8182; # 这里改成你Sshwifty后端的地址以及其监听的端口
server 127.0.0.2:8182; # 如果你有其他后端实例,可以填写多个来进行负载均衡
}
server {
listen ..... # 服务器的设置,这里省略,用你自己的就好
# 下面的Location设置会将浏览器的页面和相关资源请求转发给后端
location / {
proxy_pass http://sshwifty_backend;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
}
# 下面的Location与上面的类似,不同之处是它会转发Websocket需要用到的Connection和Upgrade头,并且强制使用HTTP/1.1连接(不会进行HTTP/2握手)。
location /sshwifty/socket {
proxy_pass http://sshwifty_backend;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
}
}
另外:
- 如果你在Sshwifty设置里指定了
HostName
,那么在反向代理的环境下就可以去掉了。因为Nginx会做相关的验证。 - 如果你的Nginx与Sshwifty是运行在同一台服务器上的,并且两个进程可以通过Loopback(
127.0.0.1
)接口进行网络通讯,那么现在你可以将Sshwifty的ListenInterface
选项设置成127.0.0.1
,让Sshwifty仅监听在Loopback上。这样可以确保只有本地进程才能连接Sshwifty后端,而外部客户端则需要通过Nginx的中转来进行访问(假定外部客户端能够访问Nginx。根据你给出的配置,我猜你大概是想要达成这样的目的)。
from sshwifty.
按照您给出的配置,我修改了nginx的配置信息,修改后使用ip:8182
会出现下面的错误,也无法使用webssh.xingjiahui.top
访问到Sshwifty,我也不清楚哪里出了问题,最终还是来请教作者了。
(我是小白,作者轻喷,哈哈,真的好想用自己的域名访问到自己服务器上的Sshwifty)
from sshwifty.
呵呵,这就是为什么我在 #21 (comment) 结尾的位置写了你可以去掉HostName
设置里的东西。因为当HostName
不为空时,Sshwifty会用其中的值来验证主机名。如果你访问的时候不是通过HostName
中设定的主机名,则Sshwifty后端会拒绝你的访问。
另外,你需要将
listen ..... # 服务器的设置,这里省略,用你自己的就好
这一行改成你原先服务器的那几行配置,包括listen
, server_name
和ssl_
之类。那一部分设置是不需要变更的,因此我在后面的答复里就没有引用了。
还有:
- 你应该在Sshwifty后端的配置里去掉TLS相关的设置,让Sshwifty运行在HTTP模式下。TLS这部分应该让Nginx去处理,就像你原先Nginx里写的配置一样。
- 如果你服务器的配置和条件许可的话,把Sshwifty的
ListenInterface
改成127.0.0.1
可以避免潜在的安全问题。详情请看一下 #21 (comment)
简单的说,就是你最后配置成这样:
[你的浏览器] -------> [你服务器上的Nginx,HTTP/HTTPS] -------> [Sshwifty后端,HTTP]
from sshwifty.
另外,在你 #21 (comment) 给出的截图里,server 0.0.0.0:8182
这个地址是不合法的。
如果你的Sshwifty实例与Nginx是运行在同一台服务器上的,并且可以通过127.0.0.1
访问的话,填写server 127.0.0.1:8182
就可以了。否则你的操作系统需要将0.0.0.0
自动转换成127.0.0.1
。
from sshwifty.
好的,感谢作者的回复,我去尝试修改!
from sshwifty.
Related Issues (20)
- Malformed module path "crypto/ecdh" HOT 1
- Demo is offline HOT 1
- Can't deploy on koyeb HOT 3
- Do you hide your docker image? HOT 2
- Set User pass on Docker HOT 1
- Authentication 选择 Password 被识别为 None HOT 3
- 有没有可能开发这样的功能 HOT 5
- Feature request: light mode HOT 1
- 能否在URL里面带上登录用的参数? HOT 1
- webssh无法连接ipv6机器,显示:connect: cannot assign requested address HOT 5
- MacOS : safari cannot find server HOT 14
- Add homebrew as an install method for macOS HOT 8
- can I generate address with ID, IP address for the direct connect HOT 1
- Default password HOT 4
- time difference - how to sync docker time ? no timezone parameter for this project ? HOT 6
- [enter] keypress is not immediately sent to target HOT 4
- Remote font error on Edge browser HOT 7
- Connecting to the Local Host HOT 1
- Unable to connect to the Sshwifty backend server: TypeError: Cannot read properties of undefined (reading 'importKey') HOT 6
- Terminal canvas not scaling properly on firefox HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sshwifty.