下为使用apache2配置qbit反向代理为例,Calibre-Web同下。
首先启用代理模块
sudo a2enmod proxy_http
写入配置
#qbittorrent-enhanced-nox
Listen port
<VirtualHost *:port>
ServerName xxx.xxx
#SSL配置
SSLEngine on
SSLCertificateFile /etc/ssl/xxx.xxx.crt
SSLCertificateKeyFile /etc/ssl/xxx.xxx.key
SSLCertificateChainFile /etc/ssl/root_bundle.crt
#关闭正向代理
ProxyRequests Off
#保留请求头内的原始请求地址
ProxyPreserveHost On
#转发至后端
ProxyPass / http://127.0.0.1:port/
#将后端发回信息转至代理网关
ProxyPassReverse / http://127.0.0.1:port/
#表示允许所有请求通过Apache代理,与旧版本的Order Deny,Allow和Allow from all组合有相同的效果。
<Proxy *>
Require all granted
</Proxy>
</VirtualHost>
另外注意,qbit设置内的Host header属性验证应处于关闭状态。
访问信息的查询可以通过/var/log/apache2/
下的日志查询,未规定的虚拟主机在other_vhosts_access.log
文件里。
对于其他应用如NextCloud或者Calibre-Web,同样注意设置可信主机,NextCloud还需要额外设置,详见Apache2 reverse proxy – NextCloud↗。
上述配置可应付大多数情况,但是对于特定功能依然要参阅官方文档解决,比如NextCloud的WebDav功能。