Databases Reference
In-Depth Information
4.
Now restart both the Liferay Portal nodes one by one and then restart the
Apache Web Server.
In the given steps, we copied all the content from the Liferay Portal node to the
public directory of the Apache Web Server. We then disabled delivering static
resources through the load balancer. That in turn delivers all unmounted static
resources from the Apache Web Server's
htdocs
directory. CSS files are also static
files. They can be served from the Apache Web Server. We intentionally did not
configure the Apache Web Server to serve CSS files because Liferay Portal 6.1 CSS
files can have dynamic code. Liferay Portal 6.1 uses the SASS framework to parse
dynamic code of CSS files when they are requested. If you are using an earlier
version of Liferay, we can also serve CSS files through the Apache Web Server.
If we configure static resource delivery through the Apache Web Server, we need to
make sure that we synchronize static resources from the Liferay Portal node to the
Apache Web Server after every deployment. It is recommended to make this process
automatic by creating shell scripts.
One of the UI best practices is to reduce the number of HTTP requests for static
resources. This can be done by merging static resources like JavaScript. Liferay
provides a built-in feature that merges most common JavaScript files dynamically.
Liferay defines the most common JavaScript files used by an unauthenticated user
using the
javascript.barebone.files
property. Similarly, it defines the most
common JavaScript files used by an authenticated user using the
javascript.
everything.files
property. Liferay combines these JS files into one file and
stores in the Application Server's
temp
directory. Each and every page loads
either the
barebone
or
everything
JS bundle. They load these JS files by calling
everything.jsp
and
barebone.jsp
.
As Liferay combines lots of JS into one file, it will be useful if we can serve these
large JS files directly through the Web Server. We can do that by performing the
following steps:
1.
Access
barebone.jsp
and
everything.jsp
from the browser and save
them into the local system.
barebone.jsp
can be accessed by using
http://<Apache
Web Server IP>/html/js/barebone.jsp?mini
fierType=js&minifierBundleId=javascript.
barebone.files
and
everything.jsp
can be accessed
by using
http://<Apache Web Server IP>/html/js/
everything.jsp?minifierType=js&minifierBundleId
=javascript.everything.files
.
2.
Now copy the downloaded
barebone.jsp
and
everything.jsp
to the
<APACHE_HOME>/htdocs /html/js/
directory.