我正在使用Liferay 7.0 GA3版本并使用Apache 2.4作为反向代理。这两台服务器都安装在Windows 2012 R2上,并且在加载liferay主页时遇到问题,其中所有JS,CSS和其他静态组件都没有显示,而是收到HTTP 500错误。
Apache配置 - (负载平衡在两个不同虚拟机上运行的两个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错误,并显示以下Respnse标题 -
请求网址: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端看起来像一些配置问题?请帮忙。