[GH-ISSUE #2269] frp转发树莓派wordpress内网博客,加装ssl证书失败 #1802

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

Originally created by @bruceluo111 on GitHub (Mar 2, 2021).
Original GitHub issue: https://github.com/fatedier/frp/issues/2269

frp version: 0.33.0
OS:树莓派3B+ Raspbian Buster(Debian 10 buster)
CPU architecture: arm v71

我用树莓派装LAMP搭的wordpress博客,再用frp通过国外VPS转发http到公网,apache本地监听端口8080,frps vhost_http_port对外端口是80。最近想给博客加ssl,就在网上搜了下教程,用的腾讯云的免费ssl, 按教程,先确认安装了openssl,然后修改apache2的配置文件,在 /etc/apache2/sites-enabled 目录下并没有SSL相关的配置文件,因为默认没有启用SSL,这个时候要把 /etc/apache2/sites-available/default-ssl.conf 文件软连接到 /etc/apache2/sites-enabled 目录下:
ln -s /etc/apache2/sites-available/default-ssl.conf /etc/apache2/sites-enabled/000-default-ssl.conf
然后编辑ssl配置文件:
sudo nano /etc/apache2/sites-enabled/000-default-ssl.conf
修改ServerName后面为自己的域名www.xxxxx.com
SSLCertificateFile, SSLCertificateKeyFile, SSLCertificateChainFile 三行取消注释,把腾讯云下载下来的证书的三个文件传到/etcc/apache2/free-tencent-ssl文件夹,并修改路径:

ServerAdmin webmaster@localhost
        DocumentRoot /var/www/html
		ServerName www.xxxxx.com

	ErrorLog ${APACHE_LOG_DIR}/error.log
	CustomLog ${APACHE_LOG_DIR}/access.log combined

	SSLEngine on

SSLCertificateFile /etc/apache2/free-tencent-ssl/2_www.xxxxx.com.crt
SSLCertificateKeyFile /etc/apache2/free-tencent-ssl/3_www.xxxxx.com.key
SSLCertificateChainFile /etc/apache2/free-tencent-ssl/1_root_bundle.crt

<FilesMatch ".(cgi|shtml|phtml|php)$">
SSLOptions +StdEnvVars

<Directory /usr/lib/cgi-bin>
SSLOptions +StdEnvVars


保存配置文件,启动ssl模块:
sudo a2enmod ssl

提示:
Considering dependency setenvif for ssl:
Module setenvif already enabled
Considering dependency mime for ssl:
Module mime already enabled
Considering dependency socache_shmcb for ssl:
Enabling module socache_shmcb.
Enabling module ssl.
See /usr/share/doc/apache2/README.Debian.gz on how to configure SSL and create self-signed certificates.
To activate the new configuration, you need to run:
systemctl restart apache2

然后按提示重启apache2:
sudo systemctl restart apache2

然后:sudo a2ensite default-ssl
提示:
Copyyogile@debyogile:/etc/apache2# sudo a2ensite default-ssl
a2ensite default-sslEnabling site default-ssl.
To activate the new configuration, you need to run:
systemctl reload apache2

按提示:sudo systemctl reload apache2
然后再重启apache2, 到这ssl按道理应该就装完了,除了强制使用https还没设置。但是我用https://www.xxxxx.com登录博客却不显示,谷歌浏览器显示

此网站无法提供安全连接www.xxxxx.com 发送的响应无效。
尝试运行 Windows 网络诊断。
ERR_SSL_PROTOCOL_ERROR

然后我去看了apache2的ports.conf:
Listen 8080

< IfModule ssl_module >
Listen 443
< /IfModule >

< IfModule mod_gnutls.c >
Listen 443
< /IfModule >

已经开启了443端口,又看了frps_full.ini:
vhost_https_port: 443
也已经开启了443,然后我又去吧wordpress博客的site url和home url都改成了:https://www.xxxxx.com, 结果还是不行,所以我就不知道到底哪里出问题了,本人小白,不是程序员,只是折腾树莓派知道了一些linux代码而已,所以想问下大家到底哪出问题了?
然后我知道frp也有给http加ssl的功能:
[test_htts2http]
type = https
custom_domains = test.yourdomain.com

plugin = https2http
plugin_local_addr = 127.0.0.1:80

plugin_crt_path = ./server.crt
plugin_key_path = ./server.key
plugin_host_header_rewrite = 127.0.0.1
plugin_header_X-From-Where = frp

我是不是直接把下载下来的ssl证书的路径替换成下面的:
plugin_crt_path = /etc/apache2/free-tencent-ssl/2_www.xxxxx.com.crt
plugin_key_path = /etc/apache2/free-tencent-ssl/3_www.xxxxx.com.key
就可以https访问博客了? 但是还剩一个1_root_bundle.crt 要放哪里?

请大神解答下,到底问题在哪?怎么才能实现wordpress博客用https访问,感谢!!!!
@BCCC0

Originally created by @bruceluo111 on GitHub (Mar 2, 2021). Original GitHub issue: https://github.com/fatedier/frp/issues/2269 frp version: 0.33.0 OS:树莓派3B+ Raspbian Buster(Debian 10 buster) CPU architecture: arm v71 我用树莓派装LAMP搭的wordpress博客,再用frp通过国外VPS转发http到公网,apache本地监听端口8080,frps vhost_http_port对外端口是80。最近想给博客加ssl,就在网上搜了下教程,用的腾讯云的免费ssl, 按教程,先确认安装了openssl,然后修改apache2的配置文件,在 /etc/apache2/sites-enabled 目录下并没有SSL相关的配置文件,因为默认没有启用SSL,这个时候要把 /etc/apache2/sites-available/default-ssl.conf 文件软连接到 /etc/apache2/sites-enabled 目录下: ln -s /etc/apache2/sites-available/default-ssl.conf /etc/apache2/sites-enabled/000-default-ssl.conf 然后编辑ssl配置文件: sudo nano /etc/apache2/sites-enabled/000-default-ssl.conf 修改ServerName后面为自己的域名www.xxxxx.com SSLCertificateFile, SSLCertificateKeyFile, SSLCertificateChainFile 三行取消注释,把腾讯云下载下来的证书的三个文件传到/etcc/apache2/free-tencent-ssl文件夹,并修改路径: <IfModule mod_ssl.c> <VirtualHost _default_:443> ServerAdmin webmaster@localhost DocumentRoot /var/www/html ServerName www.xxxxx.com ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined SSLEngine on SSLCertificateFile /etc/apache2/free-tencent-ssl/2_www.xxxxx.com.crt SSLCertificateKeyFile /etc/apache2/free-tencent-ssl/3_www.xxxxx.com.key SSLCertificateChainFile /etc/apache2/free-tencent-ssl/1_root_bundle.crt <FilesMatch "\.(cgi|shtml|phtml|php)$"> SSLOptions +StdEnvVars </FilesMatch> <Directory /usr/lib/cgi-bin> SSLOptions +StdEnvVars </Directory> </VirtualHost> </IfModule> 保存配置文件,启动ssl模块: sudo a2enmod ssl 提示: Considering dependency setenvif for ssl: Module setenvif already enabled Considering dependency mime for ssl: Module mime already enabled Considering dependency socache_shmcb for ssl: Enabling module socache_shmcb. Enabling module ssl. See /usr/share/doc/apache2/README.Debian.gz on how to configure SSL and create self-signed certificates. To activate the new configuration, you need to run: systemctl restart apache2 然后按提示重启apache2: sudo systemctl restart apache2 然后:sudo a2ensite default-ssl 提示: Copyyogile@debyogile:/etc/apache2# sudo a2ensite default-ssl a2ensite default-sslEnabling site default-ssl. To activate the new configuration, you need to run: systemctl reload apache2 按提示:sudo systemctl reload apache2 然后再重启apache2, 到这ssl按道理应该就装完了,除了强制使用https还没设置。但是我用https://www.xxxxx.com登录博客却不显示,谷歌浏览器显示: 此网站无法提供安全连接www.xxxxx.com 发送的响应无效。 尝试运行 Windows 网络诊断。 ERR_SSL_PROTOCOL_ERROR 然后我去看了apache2的ports.conf: Listen 8080 < IfModule ssl_module > Listen 443 < /IfModule > < IfModule mod_gnutls.c > Listen 443 < /IfModule > 已经开启了443端口,又看了frps_full.ini: vhost_https_port: 443 也已经开启了443,然后我又去吧wordpress博客的site url和home url都改成了:https://www.xxxxx.com, 结果还是不行,所以我就不知道到底哪里出问题了,本人小白,不是程序员,只是折腾树莓派知道了一些linux代码而已,所以想问下大家到底哪出问题了? 然后我知道frp也有给http加ssl的功能: [test_htts2http] type = https custom_domains = test.yourdomain.com plugin = https2http plugin_local_addr = 127.0.0.1:80 plugin_crt_path = ./server.crt plugin_key_path = ./server.key plugin_host_header_rewrite = 127.0.0.1 plugin_header_X-From-Where = frp 我是不是直接把下载下来的ssl证书的路径替换成下面的: plugin_crt_path = /etc/apache2/free-tencent-ssl/2_www.xxxxx.com.crt plugin_key_path = /etc/apache2/free-tencent-ssl/3_www.xxxxx.com.key 就可以https访问博客了? 但是还剩一个1_root_bundle.crt 要放哪里? 请大神解答下,到底问题在哪?怎么才能实现wordpress博客用https访问,感谢!!!! @BCCC0
gitea-mirror 2026-05-05 13:09:49 -06:00
Author
Owner

@ax2009live commented on GitHub (Mar 2, 2021):

wordpress用https2http实现不了https的,会报错的; plugin_host_header_rewrite = 127.0.0.1,这里有bug; 有时候会跳到127.0.0.1;

wordpress开启https,你用如下可以实现啊,
frpc.ini
[domain-com-443]
type = https
local_ip =wordpress服务器ip
local_port = wordpress端口
use_encryption = true
use_compression = true
custom_domains = 域名

wordpress开启https,先不要用frp去测,
先用windows主机测,修改Windows主机host文件:域名指向wordpress服务器ip,测试ok后再去用frp测;

你的主要问题: apache开启https,跟frp没有关系,个人看法:你的问题提在这里不合适;

你可以参考 https://bb.ax2009live.com/wordpress-http2-ldap/

<!-- gh-comment-id:789088782 --> @ax2009live commented on GitHub (Mar 2, 2021): wordpress用https2http实现不了https的,会报错的; plugin_host_header_rewrite = 127.0.0.1,这里有bug; 有时候会跳到127.0.0.1; wordpress开启https,你用如下可以实现啊, frpc.ini [domain-com-443] type = https local_ip =wordpress服务器ip local_port = wordpress端口 use_encryption = true use_compression = true custom_domains = 域名 wordpress开启https,先不要用frp去测, 先用windows主机测,修改Windows主机host文件:域名指向wordpress服务器ip,测试ok后再去用frp测; 你的主要问题: apache开启https,跟frp没有关系,个人看法:你的问题提在这里不合适; 你可以参考 https://bb.ax2009live.com/wordpress-http2-ldap/
Author
Owner

@bruceluo111 commented on GitHub (Mar 2, 2021):

wordpress用https2http实现不了https的,会报错的; plugin_host_header_rewrite = 127.0.0.1,这里有bug; 有时候会跳到127.0.0.1;

wordpress开启https,你用如下可以实现啊,
[domain-com-443]
type = https
local_ip =wordpress服务器ip
local_port = wordpress端口
use_encryption = true
use_compression = true
custom_domains = 域名

wordpress开启https,先不要用frp去测,修改本地host文件:域名指向wordpress服务器ip,测试ok后再去用frp测;

你可以参考 https://bb.ax2009live.com/wordpress-http2-ldap/

感谢回答,意思是frpc_full.ini直接加以下内容就行了?:
[domain-com-443]
type = https
local_ip =wordpress服务器ip
local_port = wordpress端口
use_encryption = true
use_compression = true
custom_domains = 域名

还有安装完ssl后,登录phpmyadmin也报错:OpenSSL error: error:0909006C:PEM routines:get_name:no start line
不知道这句话是说什么错误?

<!-- gh-comment-id:789116053 --> @bruceluo111 commented on GitHub (Mar 2, 2021): > wordpress用https2http实现不了https的,会报错的; plugin_host_header_rewrite = 127.0.0.1,这里有bug; 有时候会跳到127.0.0.1; > > wordpress开启https,你用如下可以实现啊, > [domain-com-443] > type = https > local_ip =wordpress服务器ip > local_port = wordpress端口 > use_encryption = true > use_compression = true > custom_domains = 域名 > > wordpress开启https,先不要用frp去测,修改本地host文件:域名指向wordpress服务器ip,测试ok后再去用frp测; > > 你可以参考 https://bb.ax2009live.com/wordpress-http2-ldap/ 感谢回答,意思是frpc_full.ini直接加以下内容就行了?: [domain-com-443] type = https local_ip =wordpress服务器ip local_port = wordpress端口 use_encryption = true use_compression = true custom_domains = 域名 还有安装完ssl后,登录phpmyadmin也报错:OpenSSL error: error:0909006C:PEM routines:get_name:no start line 不知道这句话是说什么错误?
Author
Owner

@zsinba commented on GitHub (Mar 17, 2021):

证书错误的原因.
可能 是公钥和私钥使用错误,或者证书本身就错了.

推荐使用acme.sh来管理证书.
然后acme配置dnspod或者aliyundns来进行证书的自动管理,命令:

#下载脚本,下载目录为~/.acme.sh/
curl https://get.acme.sh | sh
#创建一个别名,方面下面的命令执行
alias acme.sh=~/.acme.sh/acme.sh
#检查一下别名是否设置成功
acme.sh --version

然后下面两个命令是生成和安装证书用的:
在这之前要配置Key变量
acme.sh --issue --dns dns_ali -d www.yikalianmeng.cn
acme.sh --installcete -d www.yikalianmeng.cn --key-file /path/cert.key --fullchain-file /path/cert.pem
生成和安装 证书,后面acme会自动管理更新的.

之前 写过帖子,不知道哪去了.

<!-- gh-comment-id:800835683 --> @zsinba commented on GitHub (Mar 17, 2021): 证书错误的原因. 可能 是公钥和私钥使用错误,或者证书本身就错了. 推荐使用acme.sh来管理证书. 然后acme配置dnspod或者aliyundns来进行证书的自动管理,命令: #下载脚本,下载目录为~/.acme.sh/ curl https://get.acme.sh | sh #创建一个别名,方面下面的命令执行 alias acme.sh=~/.acme.sh/acme.sh #检查一下别名是否设置成功 acme.sh --version 然后下面两个命令是生成和安装证书用的: 在这之前要配置Key变量 acme.sh --issue --dns dns_ali -d www.yikalianmeng.cn acme.sh --installcete -d www.yikalianmeng.cn --key-file /path/cert.key --fullchain-file /path/cert.pem 生成和安装 证书,后面acme会自动管理更新的. 之前 写过帖子,不知道哪去了.
Author
Owner

@github-actions[bot] commented on GitHub (May 2, 2021):

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

<!-- gh-comment-id:830715380 --> @github-actions[bot] commented on GitHub (May 2, 2021): Issues go stale after 45d of inactivity. Stale issues rot after an additional 10d 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#1802
No description provided.