我的日常开发记录日志
首页
  • Laravel
  • Thinkphp
  • Swoole
  • Workman
  • php
  • HTML
  • CSS
  • JavaScript
  • Vue
  • ES6
  • 小程序
  • Mysql
  • Redis
  • Es
  • MongoDb
  • Git
  • Composer
  • Linux
  • Nginx
  • Docker
  • Vpn
  • 开发实战
  • 开发工具类
  • 友情链接
💖关于
💻收藏
  • 分类
  • 标签
  • 归档数据
GitHub (opens new window)

我的日常开发记录日志

never give up
首页
  • Laravel
  • Thinkphp
  • Swoole
  • Workman
  • php
  • HTML
  • CSS
  • JavaScript
  • Vue
  • ES6
  • 小程序
  • Mysql
  • Redis
  • Es
  • MongoDb
  • Git
  • Composer
  • Linux
  • Nginx
  • Docker
  • Vpn
  • 开发实战
  • 开发工具类
  • 友情链接
💖关于
💻收藏
  • 分类
  • 标签
  • 归档数据
GitHub (opens new window)
  • git

  • composer

  • linux

  • nginx

  • docker

  • vpn

  • frp

    • 安装
    • ssl访问
      • linux上安装frp客户端
    • 脚本

    • 硬件

    • 运维
    • frp
    窝窝侠
    2024-06-17

    ssl访问

    # 配置和生成 HTTPS 证书来访问 FRP 需要以下几个步骤:

    1. 生成或获取 HTTPS 证书
    2. 配置 FRP 服务端以使用 HTTPS
    3. 配置客户端和服务器

    # 1. 生成或获取 HTTPS 证书

    你可以使用 Let's Encrypt 免费生成 HTTPS 证书,或者使用其他证书颁发机构(CA)提供的证书。以下是使用 Let's Encrypt 和 Certbot 生成证书的步骤:

    # 使用 Certbot 生成证书

    1. 安装 Certbot:

      yum install epel-release
      yum install certbot
      
      1
      2
    2. 生成证书:

      certbot certonly --standalone -d yourdomain.com
      
      1

      请将 yourdomain.com 替换为你的实际域名。Certbot 会生成证书文件,通常存放在 /etc/letsencrypt/live/yourdomain.com/ 目录下。

    # 2. 配置 FRP 服务端以使用 HTTPS

    编辑 frps.ini 文件,添加 HTTPS 配置:

    [common]
    bind_port = 7000
    vhost_http_port = 7071
    vhost_https_port = 7443  # 添加 HTTPS 端口
    
    # Dashboard 配置
    dashboard_port = 7500
    dashboard_user = admin
    dashboard_pwd = admin
    
    # HTTPS 证书配置
    vhost_https_port = 443
    subdomain_host = yourdomain.com
    tls_cert_file = /etc/letsencrypt/live/yourdomain.com/fullchain.pem
    tls_key_file = /etc/letsencrypt/live/yourdomain.com/privkey.pem
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15

    # 3. 配置客户端和服务器

    # 客户端 frpc.ini 文件

    确保客户端配置文件 frpc.ini 正确配置:

    [common]
    server_addr = yourdomain.com
    server_port = 7000
    
    [http]
    type = http
    local_port = 8080
    custom_domains = yourdomain.com
    
    [https]
    type = https
    local_port = 8443
    custom_domains = yourdomain.com
    
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13

    # 启动 FRP 服务端

    重启 FRP 服务端以应用新的配置:

    systemctl restart frp
    
    1

    # 验证 HTTPS 访问

    确保你的域名指向你的服务器,并且防火墙允许 HTTPS 端口(通常是 443):

    firewall-cmd --zone=public --add-port=443/tcp --permanent
    firewall-cmd --reload
    
    1
    2

    现在,你应该能够通过 HTTPS 访问你的 FRP 服务。

    # 总结

    通过以上步骤,你已经成功生成了 HTTPS 证书,并配置了 FRP 服务端以使用 HTTPS。确保你的域名正确解析到你的服务器,并且防火墙配置正确。这样,你就可以通过 HTTPS 安全地访问你的 FRP 服务了。如果有任何问题或需要进一步的帮助,请随时提问。

    在线编辑 (opens new window)
    上次更新: 2025/02/25, 18:30:54
    安装
    linux上安装frp客户端

    ← 安装 linux上安装frp客户端→

    最近更新
    01
    showprocess用法
    04-29
    02
    vue3中尖括号和冒号的使用细则
    04-29
    03
    sd使用
    02-22
    更多文章>
    🖥️

    © 2025窝窝侠 💌 豫ICP备20005263号-2 🛀 Theme by 💝 Vdoing && 小胖墩er

    • 跟随系统
    • 浅色模式
    • 深色模式
    • 阅读模式
    ×