目前已经实现将本地的web服务暴露到公网,现想要实现https访问。(前提:已经有相应的证书文件,如果没有就去申请Let's Encrypt Authority x3
这种免费证书)
●如何利用frpc实现将本地web服务映射到公网参考文章:基于frp的内网穿透实例2-通过自定义域名访问部署于内网的 web 服务
1、修改**frps.ini
**文件
[common]
bind_port = 7000
vhost_https_port = xxx
#这里的xxx即在外网访问时加在域名后面的端口,比如www.baidu.com:80
2、重载 frps.service
**服务**
systemctl restart frps
如果想要确认是否重载成功,输入以下代码检验:
systemctl status frps -l
●如何将frpc作为服务项自动启动参考上一篇文章:frp后台自动启动的方法
1、修改**frpc.ini
**文件
[common]
server_addr = dns.ihuster.cn #服务器地址或域名
server_port = 7000
[ssh-web-8003to80]#这里先把http暴露到公网8003端口,配合反向代理实现80端口访问
type = tcp
local_ip = 127.0.0.1
local_port = 80
remote_port = 8003
[ssh-htts2http-demo]
type = https
custom_domains = frp.qimumu.top #这是你的域名
plugin = https2http #加载https2http插件
plugin_local_addr = 127.0.0.1:80 #这里的80端口是你内网http实际的监听端口
# HTTPS 证书相关的配置
plugin_crt_path = ./ssl.crt #证书命名为ssl.crt
plugin_key_path = ./ssl.key #私钥命名为ssl.crt ,这里证书和私钥都放到frp目录下
plugin_host_header_rewrite = 127.0.0.1
plugin_header_X-From-Where = frp
2、重载**frpc.service
**服务
systemctl restart frpc
1、http访问
2、https访问
成功!
扫码关注腾讯云开发者
领取腾讯云代金券
Copyright © 2013 - 2025 Tencent Cloud. All Rights Reserved. 腾讯云 版权所有
深圳市腾讯计算机系统有限公司 ICP备案/许可证号:粤B2-20090059 深公网安备号 44030502008569
腾讯云计算(北京)有限责任公司 京ICP证150476号 | 京ICP备11018762号 | 京公网安备号11010802020287
Copyright © 2013 - 2025 Tencent Cloud.
All Rights Reserved. 腾讯云 版权所有