Apache2 tomcat 負載平衡 URL 子路徑不起作用。沒有對 URL 有效的協議處理程式。
<VirtualHost *:443>
ServerName www.myexample.com
ProxyPreserveHost On
SSLProxyEngine On
SSLProxyCheckPeerCN on
SSLProxyCheckPeerExpire on
<Proxy "balancer://mycluster">
BalancerMember "https://localhost:8443" route=node1
</Proxy>
ProxyPass "/" "balancer://mycluster" stickysession=JSESSIONID|jsessionid scolonpathdelim=On
ProxyPassReverse "/" "balancer://mycluster"
...
</VirtualHost>
根 URL
https://www.myexample.com
作品。但是無法加載圖片、js/css等資源。例如,
https://www.myexample.com/images/logo.jpg
https://www.myexample.com/css/main.css
阿帕奇錯誤日志:
AH01144: No protocol handler was valid for the URL /images/logo.jpg (scheme 'balancer'). If you are using a DSO version of mod_proxy, make sure the proxy submodules are included in the configuration using LoadModule., referer: https://www.myexample.com:443/
已加載 Apache 模塊
$ sudo apachectl -M
Loaded Modules:
core_module (static)
so_module (static)
watchdog_module (static)
http_module (static)
log_config_module (static)
logio_module (static)
version_module (static)
unixd_module (static)
access_compat_module (shared)
alias_module (shared)
auth_basic_module (shared)
authn_core_module (shared)
authn_file_module (shared)
authz_core_module (shared)
authz_host_module (shared)
authz_user_module (shared)
autoindex_module (shared)
deflate_module (shared)
dir_module (shared)
env_module (shared)
filter_module (shared)
lbmethod_byrequests_module (shared)
mime_module (shared)
mpm_event_module (shared)
negotiation_module (shared)
proxy_module (shared)
proxy_balancer_module (shared)
proxy_http_module (shared)
reqtimeout_module (shared)
setenvif_module (shared)
slotmem_shm_module (shared)
socache_shmcb_module (shared)
ssl_module (shared)
status_module (shared)
還需要任何其他 apache 模塊嗎?
Server version: Apache/2.4.41 (Ubuntu)
Server built: 2022-06-14T13:30:55
uj5u.com熱心網友回復:
您應該在代理規則的末尾添加一個“/”:
ProxyPass "/" "balancer://mycluster/" stickysession=JSESSIONID|jsessionid scolonpathdelim=On
ProxyPassReverse "/" "balancer://mycluster/"
沒有它,生成的 url 為:
https://www.myexample.com/images/logo.jpg
是:
balancer://myclusterimages/logo.jpg
所以它沒有找到任何與之匹配的負載平衡規則。
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/520757.html
