【每日阅读】2020年9月13日-折腾树莓派的内网穿透

gitlab:使用frp内网穿透https

服务端配置frps.ini

[common]
bind_port = 7000
# 开通http端口监听
vhost_http_port=80
# 开通https端口监听
vhost_https_port=443

客户端配置frpc.ini

[gitlab]
type=http
local_port=1111
custom_domains=gitlab.example.com

[gitlab-https]
type=https
local_port=1111
custom_domains=gitlab.example.com

plugin = https2http
plugin_local_addr = 127.0.0.1:1111

plugin_host_header_rewrite = gitlab.example.com:443
plugin_header_X-From-Where = frp
plugin_crt_path = example.geekgao.cn.pem
plugin_key_path = example.geekgao.cn.key

需要注意的是,在阿里云申请的免费的网站https证书,是单域名的,gitlab.example.com和abc.example.com就需要申请两个不同的证书。我就是在这里耽搁了好久哈哈,一直在使用geekgao.cn的证书,这是不行的。

其他所有的web服务都可以以上面的例子为基础修改

出现的问题

会有400 bad request的报错,经常出现

gitlab:按照官方提供的方式接入https

官方文档:https://docs.gitlab.com/omnibus/settings/nginx.html#manually-configuring-https

第一步

修改/etc/gitlab/gitlab.rb

# note the 'https' below
external_url "https://gitlab.example.com"

第二步

sudo mkdir -p /etc/gitlab/ssl
sudo chmod 755 /etc/gitlab/ssl
sudo cp gitlab.example.com.key gitlab.example.com.crt /etc/gitlab/ssl/

第三步

sudo gitlab-ctl reconfigure

此时就已经OK啦!

然后frp内网穿透按照下面这么配置frpc.ini就行:

[gitlab]
type=https
local_port=443
custom_domains=gitlab.example.com

这个含义就是将远程frps端的https请求(对443端口的请求)通过和frpc的连接转发到frpc端的443端口。

【每日阅读】2020年9月13日-折腾树莓派的内网穿透

按照这个配置配置之后,完全没有报错了,是比较完美的方案。

关于网站证书的下载

我是用的是阿里云,阿里云的下载路径:https://yundun.console.aliyun.com/?p=cas

这个页面会有很多的自己已经有的证书,下载即可。没有的话可以立刻申请,算上填写信息,不超过5分钟就可以有一个新的证书了。那是相当的快,主要是免费。点击页面的“购买证书”后的申请方式如下

【每日阅读】2020年9月13日-折腾树莓派的内网穿透

原创文章,作者:geekgao,如若转载,请注明出处:https://www.geekgao.cn/archives/2425

(1)
geekgaogeekgao博主
上一篇 2020年9月13日 上午1:24
下一篇 2020年9月15日 上午3:46

相关推荐

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注

GitHub
分享本页
返回顶部

Warning: error_log(/usr/local/lighthouse/softwares/wordpress/wp-content/plugins/spider-analyser/#log/log-2612.txt): failed to open stream: No such file or directory in /usr/local/lighthouse/softwares/wordpress/wp-content/plugins/spider-analyser/spider.class.php on line 2900