我正在使用 Liferay 7.0 GA3 版本并使用 Apache 2.4 作为反向代理。两台服务器都安装在 Windows 2012 R2 上,并且在加载 liferay 主页时遇到问题,其中所有 JS、CSS 和其他静态组件都没有显示,而是出现 HTTP 500 错误。
Apache config - (负载平衡在两个不同 VM 上运行的两个 Liferay 服务器)
httpd.conf -
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
LoadModule proxy_connect_module modules/mod_proxy_connect.so
LoadModule proxy_http_module modules/mod_proxy_http.so
RewriteEngine On
#forces everything under /web/guest/signup to secure if non-secure (https)
RewriteCond %{SERVER_PORT} =80
RewriteRule ^(.*)$ https://%{SERVER_NAME}:443$1 [R,L]
ProxyRequests Off
<Location / >
ProxyPass balancer://mybalancer stickysession=JSESSIONID
ProxyPassReverse "balancer://mybalancer" stickysession=JSESSIONID
</Location>
<Proxy balancer://mybalancer>
BalancerMember ajp://my.server.com:8009/ route=s1
BalancerMember ajp://my.server2.com:8009/ route=s2
</Proxy>
httpd-ssl.conf -
<VirtualHost _default_:443>
SSLEngine on
ServerName my.server.com:443
SSLCertificateFile "${SRVROOT}/conf/ssl/lr-stage-server.crt"
SSLCertificateKeyFile "${SRVROOT}/conf/ssl/lr-stage-server.key"
DocumentRoot "${SRVROOT}/htdocs"
# DocumentRoot access handled globally in httpd.conf
CustomLog "${SRVROOT}/logs/ssl_request.log" \
"%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"
<Directory "${SRVROOT}/htdocs">
Options Indexes Includes FollowSymLinks
AllowOverride AuthConfig Limit FileInfo
Require all granted
</Directory>
Header always set Strict-Transport-Security "max-age=63072000; includeSubDomains"
</virtualhost>
已更改两台服务器上的 tomcat server.xml -
<Engine name="Catalina" defaultHost="localhost" jvmRoute="s1"> and
<Engine name="Catalina" defaultHost="localhost" jvmRoute="s2">
我在浏览器上遇到以下错误-
https://my.server.com/combo?browserId=other&minifierType=&theme…duct_menu_web_portlet_ProductMenuPortlet:%2Fcss%2Fmain.css&t=1478912808000 Failed to load resource: the server responded with a status of 500 (Internal Server Error)
https://my.server.com/image/layout_set_logo?img_id=44936&t=1483591866720 Failed to load resource: the server responded with a status of 500 (Internal Server Error)
Apache 错误日志 -
[Wed Jan 04 23:15:15.954935 2017] [proxy:warn] [pid 5320:tid 1060] [client 10.99.59.8:61057] AH01144: No protocol handler was valid for the URL /o/classic-theme/css/main.css. If you are using a DSO version of mod_proxy, make sure the proxy submodules are included in the configuration using LoadModule., referer: https://my.server.com/
[Wed Jan 04 23:15:16.270960 2017] [proxy:warn] [pid 5320:tid 1064] [client 10.99.59.8:61062] AH01144: No protocol handler was valid for the URL /image/layout_set_logo. If you are using a DSO version of mod_proxy, make sure the proxy submodules are included in the configuration using LoadModule., referer: https://my.server.com/
如果我尝试将其中一个失败的 Apache URL 直接访问到另一个浏览器窗口,我会收到 HTTP 500 错误,并带有以下响应标头 -
请求网址:https ://my.server.com/o/mentions-web/css/mentions.css
响应标头
Connection:close
Content-Length:530
Content-Type:text/html; charset=iso-8859-1
Date:Thu, 05 Jan 2017 05:20:15 GMT
Server:Apache/2.4.23 (Win64) OpenSSL/1.0.2h
Strict-Transport-Security:max-age=63072000; includeSubDomains
如果我尝试使用连接到 Tomcat 的相同 URL(因此绕过 Apache),那么我将获得 HTTP 200 并带有以下响应标头 -
请求网址:http ://my.server.com:8080/o/mentions-web/css/mentions.css
响应标头
Cache-Control:max-age=315360000, public
Content-Encoding:gzip
Content-Length:195
Content-Type:text/css
Date:Thu, 05 Jan 2017 05:20:52 GMT
ETag:"d187c5"
Server:Apache-Coyote/1.1
Set-Cookie:JSESSIONID=C41D0DA1E582219136FBBC8D8466F2F4.s1; Path=/; HttpOnly
X-Content-Type-Options:nosniff
X-Frame-Options:SAMEORIGIN
X-XSS-Protection:1
需要注意的一件事是,如果我删除负载平衡配置并尝试将一个 apache 实例连接到一个 liferay 服务器,那么一切正常。
ProxyPass / ajp://my.server.com:8009/
ProxyPassReverse / ajp://my.server.com:8009/
所以看起来像apache方面的一些配置问题?请帮忙。