前期准备
公网服务器一台(以winsever2019为例)
内网机器一台
frp配置文件
下载链接:frp-github
环境配置:
下载好对应的安装包之后解压,将frpc.exe
和frpc.ini
复制到内网机上;frps.exe和frps.ini复制到服务器上分别配置,剩余文件没用可以删了。
服务器配置
打开frps.ini
复制以下代码到frps.ini
[common]
#frps绑定端口
bind_port = 7000
# http 访问端口
vhost_http_port = 80
#服务端监控
dashboard_port = 7500
dashboard_user = admin
dashboard_pwd = admin
#用这个可以指定域名,客户端可以使用 subdomain,指定一个二级域名。
#用了这个属性,客户端无法开启 custom_domains ,否则服务异常。
#subdomain_host = raven520.top
# token校验
token=raven
注:以上的端口均需要在控制台的防火墙开放
客户端配置:
[common]
server_addr =服务器ip
server_port = 7000
token=raven
#对于单个网站的内网穿透映射到公网
[web]
type = http
local_ip = 127.0.0.1(可修改为内网下其他主机IP)
local_port = 80
custom_domains=your domain
[web2]
type = https
local_ip = 内网ip
local_port = 80
custom_domains = 公网服务器ip
[ssh]
type = tcp
local_ip = 内网ip
local_port = 3389
remote_port = 公网IP的一个端口号
#http代理,全局代理
[http_proxy]
type = tcp
remote_port = 转发到公网IP的端口号
plugin = http_proxy
plugin_http_user = 账号
plugin_http_passwd = 密码
服务端启动
在frps.exe
和frps.ini
所在的文件夹启动cmd执行
frps -c frps.ini
客户端启动
在frpc.exe和frpc.ini所在的文件夹启动cmd执行
frp -c frpc.ini
但是这样frp运行的时候总是占用一个窗口,这就看起来很难受怎么才可以隐藏呢?
以客户端为例
首先新建一个文本文档在开头处写入
@echo off
if "%1" == "h" goto begin
mshta vbscript:createobject("wscript.shell").run("""%~nx0"" h",0)(window.close)&&exit
:begin
REM
frpc.exe -c frpc.ini
其中frpc.exe -c frpc.ini
为运行命令。
另存为.bat文件,放在frp目录下,双击该bat文件会在屏幕中一闪而过。
不会出现在桌面,只会在任务管理器出现
添加开机启动项
要想开机启动并运行只需要把那个bat文件放进开机启动文件夹即可
打开开机启动文件夹,win
+r
打开运行输入 shell:startup
回车
参考文章:
https://blog.csdn.net/e891377/article/details/89634404
https://blog.csdn.net/huijiaaa1/article/details/104318369
版权属于:DATA
本文链接:https://zhlblog.cn/%E5%8E%9F%E5%88%9B/18.html
转载时须注明出处及本声明
shell:startup学到了