[GH-ISSUE #3222] https穿透老是报证书错误 请大佬指导 #2585

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

Originally created by @chenmo-tssz on GitHub (Dec 20, 2022).
Original GitHub issue: https://github.com/fatedier/frp/issues/3222

Describe the feature request

我在本地用nginx 搭建了个小博客192.168.1.7能访问
nginx default.conf 配置如下:

server {
    listen                  80;
    listen                  [::]:80;
    server_name             frp.***.cn;
    location / {
        return 301 https://$host$request_uri;
}
}
server {
    listen                   443 ssl http2;
     listen                  [::]:443 ssl http2;
     server_name             frp.cmsblog.cn;
     root                    /var/www/localhost/htdocs;
     index                   index.php index.html;
     client_max_body_size    32m;
     error_page              500 502 503 504  /50x.html;
     ssl                     on;
     ssl_certificate         /root/frp/frp.***.cn_bundle.crt;
     ssl_certificate_key     /root/frp/frp.***.cn.key;
    # Everything is a 404
            location ~ \.php$ {
              fastcgi_index     index.php;
              fastcgi_pass      127.0.0.1:9000;
              include           fastcgi.conf;
        }
  location / {
    try_files $uri $uri/ /index.php?$query_string;
  }
}

frpc.ini 搭建在192.168.1.10上面。

[test_htypecho]
type = https
custom_domains = frp.***.cn

plugin = https2http
plugin_local_addr = 192.168.1.7:80
plugin_crt_path = /root/frp/frp.***_bundle.crt
plugin_key_path = /root/frp/frp.***.cn.key
plugin_host_header_rewrite = 192.168.1.7
plugin_header_X-From-Where = frp`

frps.ini  应该是不用配置证书的吧
```vhost_http_port = 80
vhost_https_port = 443

为什么访问 https://frp.***.cn 就直接跳转到192.168.1.7 提示证书错误。证书申请的是免费一年的。

求大神帮忙。

Describe alternatives you've considered

No response

Affected area

  • Docs
  • Installation
  • Performance and Scalability
  • Security
  • User Experience
  • Test and Release
  • Developer Infrastructure
  • Client Plugin
  • Server Plugin
  • Extensions
  • Others
Originally created by @chenmo-tssz on GitHub (Dec 20, 2022). Original GitHub issue: https://github.com/fatedier/frp/issues/3222 ### Describe the feature request 我在本地用nginx 搭建了个小博客192.168.1.7能访问 nginx default.conf 配置如下: ``` server { listen 80; listen [::]:80; server_name frp.***.cn; location / { return 301 https://$host$request_uri; } } server { listen 443 ssl http2; listen [::]:443 ssl http2; server_name frp.cmsblog.cn; root /var/www/localhost/htdocs; index index.php index.html; client_max_body_size 32m; error_page 500 502 503 504 /50x.html; ssl on; ssl_certificate /root/frp/frp.***.cn_bundle.crt; ssl_certificate_key /root/frp/frp.***.cn.key; # Everything is a 404 location ~ \.php$ { fastcgi_index index.php; fastcgi_pass 127.0.0.1:9000; include fastcgi.conf; } location / { try_files $uri $uri/ /index.php?$query_string; } } ``` frpc.ini 搭建在192.168.1.10上面。 ``` [test_htypecho] type = https custom_domains = frp.***.cn plugin = https2http plugin_local_addr = 192.168.1.7:80 plugin_crt_path = /root/frp/frp.***_bundle.crt plugin_key_path = /root/frp/frp.***.cn.key plugin_host_header_rewrite = 192.168.1.7 plugin_header_X-From-Where = frp` frps.ini 应该是不用配置证书的吧 ```vhost_http_port = 80 vhost_https_port = 443 ``` 为什么访问 https://frp.***.cn 就直接跳转到192.168.1.7 提示证书错误。证书申请的是免费一年的。 求大神帮忙。 ### Describe alternatives you've considered _No response_ ### Affected area - [ ] Docs - [ ] Installation - [ ] Performance and Scalability - [ ] Security - [ ] User Experience - [ ] Test and Release - [ ] Developer Infrastructure - [ ] Client Plugin - [ ] Server Plugin - [ ] Extensions - [ ] Others
gitea-mirror 2026-05-05 13:39:51 -06:00
Author
Owner

@superzjg commented on GitHub (Dec 20, 2022):

这两行删除再试试:
plugin_host_header_rewrite = 192.168.1.7
plugin_header_X-From-Where = frp`

<!-- gh-comment-id:1358898954 --> @superzjg commented on GitHub (Dec 20, 2022): 这两行删除再试试: plugin_host_header_rewrite = 192.168.1.7 plugin_header_X-From-Where = frp`
Author
Owner

@chenmo-tssz commented on GitHub (Dec 20, 2022):

这两行删除再试试: plugin_host_header_rewrite = 192.168.1.7 plugin_header_X-From-Where = frp`

没用 一样的报错

<!-- gh-comment-id:1358974764 --> @chenmo-tssz commented on GitHub (Dec 20, 2022): > 这两行删除再试试: plugin_host_header_rewrite = 192.168.1.7 plugin_header_X-From-Where = frp` 没用 一样的报错
Author
Owner

@superzjg commented on GitHub (Dec 20, 2022):

这两行删除再试试: plugin_host_header_rewrite = 192.168.1.7 plugin_header_X-From-Where = frp`

换个证书试试,比如用OpenSSL生成的自签名证书

<!-- gh-comment-id:1359056159 --> @superzjg commented on GitHub (Dec 20, 2022): > 这两行删除再试试: plugin_host_header_rewrite = 192.168.1.7 plugin_header_X-From-Where = frp` > 换个证书试试,比如用OpenSSL生成的自签名证书
Author
Owner

@Becods commented on GitHub (Dec 20, 2022):

[web]
type = https
local_port = 443
custom_domains = frp.***.cn
<!-- gh-comment-id:1359602306 --> @Becods commented on GitHub (Dec 20, 2022): ``` [web] type = https local_port = 443 custom_domains = frp.***.cn ```
Author
Owner

@AlpacaBi commented on GitHub (Dec 23, 2022):

建议用docker装个nginx-proxy-manager,web ui操作nginx反向代理,还能一键申请证书。

然后反代到frp,frp只走http就好了,https nginx已经有了。

这种操作方式比较简单。

<!-- gh-comment-id:1364122046 --> @AlpacaBi commented on GitHub (Dec 23, 2022): 建议用docker装个nginx-proxy-manager,web ui操作nginx反向代理,还能一键申请证书。 然后反代到frp,frp只走http就好了,https nginx已经有了。 这种操作方式比较简单。
Author
Owner

@ax2009live commented on GitHub (Jan 2, 2023):

frpc.ini 搭建在192.168.1.10上面


[test_htypecho]
type = https
local_ip = 192.168.31.7
local_port = 443
custom_domains = frp.***.cn
use_encryption = true
use_compression = true
tls_enable = true
https:// frp.***.cn 就会调取 https://192.168.31.7

可以在frpc.ini 集中处理: 泛域名 http://*.domain.cn 跳转到 https://*.domain.cn
<!-- gh-comment-id:1369223656 --> @ax2009live commented on GitHub (Jan 2, 2023): frpc.ini 搭建在192.168.1.10上面 <pre> [test_htypecho] type = https local_ip = 192.168.31.7 local_port = 443 custom_domains = frp.***.cn use_encryption = true use_compression = true tls_enable = true</pre> <pre> https:// frp.***.cn 就会调取 https://192.168.31.7 可以在frpc.ini 集中处理: 泛域名 http://*.domain.cn 跳转到 https://*.domain.cn</pre>
Author
Owner

@github-actions[bot] commented on GitHub (Feb 2, 2023):

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

<!-- gh-comment-id:1412973955 --> @github-actions[bot] commented on GitHub (Feb 2, 2023): Issues go stale after 30d of inactivity. Stale issues rot after an additional 7d of inactivity and eventually close.
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#2585
No description provided.