查看谁在访问你的站点:修订间差异
外观
无编辑摘要 |
无编辑摘要 |
||
| 第63行: | 第63行: | ||
'''如果在重启时报错 <code>Invalid command 'RemoteIPProxyProtocol'</code>:''' 这说明你的 Apache 版本太低,或者 <code>remoteip</code> 模块没加载成功。此时你可能需要升级 Apache,或者改用 Nginx 作为前置转发,因为 Nginx 对该协议的支持更早且更稳定。 | '''如果在重启时报错 <code>Invalid command 'RemoteIPProxyProtocol'</code>:''' 这说明你的 Apache 版本太低,或者 <code>remoteip</code> 模块没加载成功。此时你可能需要升级 Apache,或者改用 Nginx 作为前置转发,因为 Nginx 对该协议的支持更早且更稳定。 | ||
使用过程中发现宿主机无法访问站点遂有接下来操作。 | |||
# 删除之前frpc.ini的配置即:<code>#proxy_protocol_version=v2</code> | |||
# 重启frpc | |||
# 开启apache的remoteip模块:<code>sudo a2enmod remoteip</code> | |||
# 修改apache虚拟主机配置(在/etc/apache2/sites-enabled/config.conf)<syntaxhighlight> | |||
<VirtualHost *:443> | |||
ServerName 你的域名 | |||
# --- 核心配置开始 --- | |||
# 1. 确保关闭 Proxy Protocol (如果之前开了的话) | |||
RemoteIPProxyProtocol Off | |||
# 2. 指定从 X-Forwarded-For 头部获取 IP | |||
RemoteIPHeader X-Forwarded-For | |||
# 3. 信任来自本地 frp 的代理请求 | |||
RemoteIPInternalProxy 127.0.0.1 | |||
# --- 核心配置结束 --- | |||
# ... 原有的 SSL 证书配置和 MediaWiki 目录配置保持不变 ... | |||
SSLEngine on | |||
SSLCertificateFile /path/to/cert | |||
</VirtualHost> | |||
</syntaxhighlight> | |||
ok重启验证 | |||
* '''测试配置:''' <code>sudo apache2ctl configtest</code> (应显示 Syntax OK) | |||
* '''重启:''' <code>sudo systemctl restart apache2</code> | |||
[[分类:Apache]] | [[分类:Apache]] | ||