Content Delivery Network
Content Delivery Network (CDN) is a large network of servers deployed across the world to serve static resources. The same static resources are stored on multiple servers across the world.
This feature reduces response time drastically. Liferay Portal also supports integration with CDNs.
To configure Liferay with CDN, we need to perform the following steps:
1. Upload all the static resources from the theme into CDN. CDN providers provide the UI to do the same.
2. Add the following properties to the portal-ext.properties file:
cdn.host.http = < CDN host name to server static resources from http request >
cdn.host.https = < CDN host name to server static resources from https request >
This solution is highly recommended when the intended users are spread across the globe.
Content delivery through the web server
If we serve static resources directly from the web server, it can reduce the number of requests coming to the Liferay Portal application server.
Static resources can be served faster from the web server than the application server.
All portal requests pass through the web server. Hence, it is easy to filter static resource requests and serve them directly from the web server.
We need to copy all static resources from all the Liferay plugins to the web server public directory.
We need to make changes in the web server configuration so that all the static resource requests are directly served from the web server public directory.
We need to ensure that we copy the static resources to the web server every time we deploy a new version.
It is recommended to create an automated shell script to copy static resources from the Liferay Portal application server to the Apache web server as a part of the deployment process.