[GH-ISSUE #2374] 请问dashboard如何使能https? #1885

Closed
opened 2026-05-05 13:13:06 -06:00 by gitea-mirror · 13 comments
Owner

Originally created by @galaxyskyknight on GitHub (Apr 30, 2021).
Original GitHub issue: https://github.com/fatedier/frp/issues/2374

默认7500(或者换其他端口)只能支持https. frps里也没有找到配置dashboard支持https的地方,现在chrome等浏览器都是强制跳https,不做点配置根本访问不到dashboard

Originally created by @galaxyskyknight on GitHub (Apr 30, 2021). Original GitHub issue: https://github.com/fatedier/frp/issues/2374 默认7500(或者换其他端口)只能支持https. frps里也没有找到配置dashboard支持https的地方,现在chrome等浏览器都是强制跳https,不做点配置根本访问不到dashboard
gitea-mirror 2026-05-05 13:13:06 -06:00
Author
Owner

@fatedier commented on GitHub (Apr 30, 2021):

  1. 并没有浏览器强制跳转的说法,HTTP 的网站仍然可以访问。
  2. 结合 nginx 或其他 webserver 可以配置 HTTPS。
<!-- gh-comment-id:829956940 --> @fatedier commented on GitHub (Apr 30, 2021): 1. 并没有浏览器强制跳转的说法,HTTP 的网站仍然可以访问。 2. 结合 nginx 或其他 webserver 可以配置 HTTPS。
Author
Owner

@galaxyskyknight commented on GitHub (Apr 30, 2021):

是可以访问,但chrome、edge等浏览器会强制吧http://xxx转换成https://xxx导致SSL错误,需要在chrome里设置
参考:
https://blog.csdn.net/u011215669/article/details/93086915

<!-- gh-comment-id:829958156 --> @galaxyskyknight commented on GitHub (Apr 30, 2021): 是可以访问,但chrome、edge等浏览器会强制吧http://xxx转换成https://xxx导致SSL错误,需要在chrome里设置 参考: https://blog.csdn.net/u011215669/article/details/93086915
Author
Owner

@fatedier commented on GitHub (Apr 30, 2021):

并不会,blog 内容仅供参考

<!-- gh-comment-id:829972589 --> @fatedier commented on GitHub (Apr 30, 2021): 并不会,blog 内容仅供参考
Author
Owner

@galaxyskyknight commented on GitHub (Apr 30, 2021):

  1. 并没有浏览器强制跳转的说法,HTTP 的网站仍然可以访问。
  2. 结合 nginx 或其他 webserver 可以配置 HTTPS。

不太会配nginx,现在netstat看到的是7500是由frps进程监听的,所以它的webserver是内置的?如何配成dashboard由nginx去起?

<!-- gh-comment-id:830464671 --> @galaxyskyknight commented on GitHub (Apr 30, 2021): > 1. 并没有浏览器强制跳转的说法,HTTP 的网站仍然可以访问。 > 2. 结合 nginx 或其他 webserver 可以配置 HTTPS。 不太会配nginx,现在netstat看到的是7500是由frps进程监听的,所以它的webserver是内置的?如何配成dashboard由nginx去起?
Author
Owner

@galaxyskyknight commented on GitHub (May 1, 2021):

Nginx反代
实例:https://frp.wo25.net:27500

具体怎么配的?给个nginx配置示例看看?frps.ini要改吗?

<!-- gh-comment-id:830568273 --> @galaxyskyknight commented on GitHub (May 1, 2021): > Nginx反代 > 实例:https://frp.wo25.net:27500 具体怎么配的?给个nginx配置示例看看?frps.ini要改吗?
Author
Owner

@xqzr commented on GitHub (May 4, 2021):

Nginx反代
实例:https://frp.wo25.net:27500

具体怎么配的?给个nginx配置示例看看?frps.ini要改吗?

server {
 listen       7501 ssl http2; #监听端口
 ssl_certificate      xxxx.net_ecc/fullchain.cer; #证书路径
 ssl_certificate_key  xxxx.net_ecc/xxxx.net.key; #证书私钥路径
 location / {
  proxy_pass   http://127.0.0.1:7500; #仪表盘访问地址
  proxy_http_version 1.1;
  proxy_set_header X-Real-IP $remote_addr;
 }
}
<!-- gh-comment-id:831838845 --> @xqzr commented on GitHub (May 4, 2021): > > Nginx反代 > > 实例:https://frp.wo25.net:27500 > > 具体怎么配的?给个nginx配置示例看看?frps.ini要改吗? ``` server { listen 7501 ssl http2; #监听端口 ssl_certificate xxxx.net_ecc/fullchain.cer; #证书路径 ssl_certificate_key xxxx.net_ecc/xxxx.net.key; #证书私钥路径 location / { proxy_pass http://127.0.0.1:7500; #仪表盘访问地址 proxy_http_version 1.1; proxy_set_header X-Real-IP $remote_addr; } } ```
Author
Owner

@galaxyskyknight commented on GitHub (May 7, 2021):

Nginx反代
实例:https://frp.wo25.net:27500

具体怎么配的?给个nginx配置示例看看?frps.ini要改吗?

server {
 listen       7501 ssl http2; #监听端口
 ssl_certificate      xxxx.net_ecc/fullchain.cer; #证书路径
 ssl_certificate_key  xxxx.net_ecc/xxxx.net.key; #证书私钥路径
 location / {
  proxy_pass   http://127.0.0.1:7500; #仪表盘访问地址
  proxy_http_version 1.1;
  proxy_set_header X-Real-IP $remote_addr;
 }
}

感谢,已搞定,另外@fatedier 大佬,frp dashboard能否自定义style和banner标题啊,看着太丑了。。。。而且登录输入用户名密码能否有个portal内嵌到网页里面,不用弹出对话框的形式,很不友好?这样访问端口很容易泄露网站内容。

<!-- gh-comment-id:834098609 --> @galaxyskyknight commented on GitHub (May 7, 2021): > > > Nginx反代 > > > 实例:https://frp.wo25.net:27500 > > > > > > 具体怎么配的?给个nginx配置示例看看?frps.ini要改吗? > > ``` > server { > listen 7501 ssl http2; #监听端口 > ssl_certificate xxxx.net_ecc/fullchain.cer; #证书路径 > ssl_certificate_key xxxx.net_ecc/xxxx.net.key; #证书私钥路径 > location / { > proxy_pass http://127.0.0.1:7500; #仪表盘访问地址 > proxy_http_version 1.1; > proxy_set_header X-Real-IP $remote_addr; > } > } > ``` 感谢,已搞定,另外@fatedier 大佬,frp dashboard能否自定义style和banner标题啊,看着太丑了。。。。而且登录输入用户名密码能否有个portal内嵌到网页里面,不用弹出对话框的形式,很不友好?这样访问端口很容易泄露网站内容。
Author
Owner

@fatedier commented on GitHub (May 7, 2021):

@galaxyskyknight 可以在 frps.ini 中配置 asserts_dir 参数指定你自己的 web 资源,如果你有能力的话,可以自行开发前端页面。

<!-- gh-comment-id:834107510 --> @fatedier commented on GitHub (May 7, 2021): @galaxyskyknight 可以在 frps.ini 中配置 `asserts_dir` 参数指定你自己的 web 资源,如果你有能力的话,可以自行开发前端页面。
Author
Owner

@ax2009live commented on GitHub (May 13, 2021):

大家都想保证安全,在服务器端实现http - https,
ngnix 反代是一个方法,也可以使用 frp 插件 https2http,简单粗暴有效;
可以参考关闭的 issue, https://github.com/fatedier/frp/issues/2185

如果通过 docker实现,更灵活,( 你可以用 docker 在同一 vps 运行多个 frps fprc )
证书位置:/root/nginx/certs/
配置文件:/root/conf/frpc.ini

docker run -d \
	--name frpc \
	--restart=always \
	-v /root/nginx/certs/:/root/nginx/certs/ \
	-v /root/conf/frpc.ini:/etc/frpc.ini \
	leonismoe/frpc:v0.35.1

/root/conf/frpc.ini

[common]
server_addr =  服务器的 ip
server_port = 7000
token = 密码

[www.examda.com-443]
type = https
custom_domains = www.examda.com
# 你的域名
plugin = https2http
plugin_local_addr = 服务器的 ip:7500
# dashboard 服务器的 IP 和端口
plugin_crt_path = /root/nginx/certs/fullchain.pem
plugin_key_path = /root/nginx/certs/key.pem
# 证书位置,可以通过 docker 申请安装,可以通过 crontab -e 增加每月定时执行这个动作
# https://bb.ax2009live.com/install-the-certificate-automatically-update-every-month/
plugin_host_header_rewrite = 127.0.0.1
plugin_header_X-From-Where = frp
use_encryption = true
use_compression = true
tls_enable = true

如果frps frpc 都是用 docker 创建的,避免frps frpc 长期运作后,产生莫名其妙的问题,每天定时重启容器;
crontab -e 增加每天6时定时执行重启所有容器(每天6时0分执行):

0 6 * * * docker restart $(docker ps -a | awk '{ print $1}' | tail -n +2)

自己亲测:每天定期重启 docker 后,再也不会出现连接不上的问题,无人为干预的情况下,已稳定运行几个月;

<!-- gh-comment-id:840223183 --> @ax2009live commented on GitHub (May 13, 2021): 大家都想保证安全,在服务器端实现http - https, ngnix 反代是一个方法,也可以使用 frp 插件 https2http,简单粗暴有效; 可以参考关闭的 issue, https://github.com/fatedier/frp/issues/2185 如果通过 docker实现,更灵活,( 你可以用 docker 在同一 vps 运行多个 frps fprc ) 证书位置:/root/nginx/certs/ 配置文件:/root/conf/frpc.ini <pre>docker run -d \ --name frpc \ --restart=always \ -v /root/nginx/certs/:/root/nginx/certs/ \ -v /root/conf/frpc.ini:/etc/frpc.ini \ leonismoe/frpc:v0.35.1</pre> /root/conf/frpc.ini <pre>[common] server_addr = 服务器的 ip server_port = 7000 token = 密码 [www.examda.com-443] type = https custom_domains = www.examda.com # 你的域名 plugin = https2http plugin_local_addr = 服务器的 ip:7500 # dashboard 服务器的 IP 和端口 plugin_crt_path = /root/nginx/certs/fullchain.pem plugin_key_path = /root/nginx/certs/key.pem # 证书位置,可以通过 docker 申请安装,可以通过 crontab -e 增加每月定时执行这个动作 # https://bb.ax2009live.com/install-the-certificate-automatically-update-every-month/ plugin_host_header_rewrite = 127.0.0.1 plugin_header_X-From-Where = frp use_encryption = true use_compression = true tls_enable = true</pre> 如果frps frpc 都是用 docker 创建的,避免frps frpc 长期运作后,产生莫名其妙的问题,每天定时重启容器; crontab -e 增加每天6时定时执行重启所有容器(每天6时0分执行): <pre>0 6 * * * docker restart $(docker ps -a | awk '{ print $1}' | tail -n +2)</pre> 自己亲测:每天定期重启 docker 后,再也不会出现连接不上的问题,无人为干预的情况下,已稳定运行几个月;
Author
Owner

@tiagogbarbosa commented on GitHub (May 19, 2021):

docker restart $(docker ps -a | awk '{ print $1}' | tail -n +2)

Is the same as
docker restart $(docker ps -aq)

;)

<!-- gh-comment-id:843665791 --> @tiagogbarbosa commented on GitHub (May 19, 2021): docker restart $(docker ps -a | awk '{ print $1}' | tail -n +2) Is the same as docker restart $(docker ps -aq) ;)
Author
Owner

@galaxyskyknight commented on GitHub (May 21, 2021):

谢谢楼上,我已经用nginx反代搞定了,也不麻烦。

<!-- gh-comment-id:845702843 --> @galaxyskyknight commented on GitHub (May 21, 2021): 谢谢楼上,我已经用nginx反代搞定了,也不麻烦。
Author
Owner

@github-actions[bot] commented on GitHub (Jul 23, 2021):

Issues go stale after 45d of inactivity. Stale issues rot after an additional 10d of inactivity and eventually close.

<!-- gh-comment-id:885326122 --> @github-actions[bot] commented on GitHub (Jul 23, 2021): Issues go stale after 45d of inactivity. Stale issues rot after an additional 10d of inactivity and eventually close.
Author
Owner

@ax2009live commented on GitHub (Apr 15, 2023):

docker restart $(docker ps -a | awk '{ print $1}' | tail -n +2)

Is the same as docker restart $(docker ps -aq)

;)

@tiagogbarbosa 你是对的,简洁多了;厉害,谢谢!
docker ps --help 查看帮助
Usage: docker ps [OPTIONS]
List containers
Options:
-a, --all Show all containers (default shows just running) 显示所有容器(默认仅显示运行的容器)
-f, --filter filter Filter output based on conditions provided
--format string Pretty-print containers using a Go template
-n, --last int Show n last created containers (includes all states) (default -1)
-l, --latest Show the latest created container (includes all states)
--no-trunc Don't truncate output
-q, --quiet Only display container IDs 仅显示容器的 ID 号;
-s, --size Display total file sizes

docker restart $(docker ps -aq) 重新启动所有的容器
docker restart $(docker ps -q) 重新启动正运行的容器

<!-- gh-comment-id:1509578676 --> @ax2009live commented on GitHub (Apr 15, 2023): > docker restart $(docker ps -a | awk '{ print $1}' | tail -n +2) > > Is the same as docker restart $(docker ps -aq) > > ;) @tiagogbarbosa 你是对的,简洁多了;厉害,谢谢! docker ps --help 查看帮助 Usage: docker ps [OPTIONS] List containers Options: -a, --all Show all containers (default shows just running) 显示所有容器(默认仅显示运行的容器) -f, --filter filter Filter output based on conditions provided --format string Pretty-print containers using a Go template -n, --last int Show n last created containers (includes all states) (default -1) -l, --latest Show the latest created container (includes all states) --no-trunc Don't truncate output -q, --quiet Only display container IDs 仅显示容器的 ID 号; -s, --size Display total file sizes docker restart $(docker ps -aq) 重新启动所有的容器 docker restart $(docker ps -q) 重新启动正运行的容器
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/frp#1885
No description provided.