Chapter 60: Alternate Media Storage . Naxa AC-1

Add to my manuals

advertisement

Chapter 60: Alternate Media Storage
. Naxa AC-1 | Manualzz

Chapter 60:

Alternate Media Storage

Magento Community Edition gives you the option to store media files in a database on a database server, or on a Content Delivery Network (CDN), as opposed to storing them on the file system of the web server. The advantage of using alternate storage is that it minimizes the effort required to synchronize media when multiple instances of the system that are deployed on different servers that need access to the same images, CSS files, and other media files.

CDN as alternate media storage is implemented as a support option only, not as a full integration with a specific CDN. You must choose and configure a CDN on your own.

Using a Database for Media Storage

By default, all images, compiled CSS files, and compiled JavaScript files of the

Magento instance are stored in the file system on the web server. You can choose to store these files in a database on a database server. One advantage of this approach is the option of automatic synchronization and reverse synchronization between the web server file system and the database. You can use the default database to store media or create a new one. To be able to use a newly created database as media storage, you must add information about it and its access credentials to the local.xml file.

To use a database for media storage:

1.

On the Admin menu, select System > Configuration .

2.

In the panel on the left, under Advanced, select System .

3.

This configuration takes place at the global level, so set Current Configuration

Scope to “Default Config.”

4.

Click to expand the Storage Configuration for Media section. Then, do the following:

Magento Community Edition: User Guide 667

Using a Content Delivery Network Chapter 60: Alternate Media Storage

668

Storage Configuration for Media a.

Set Media Storage to “Database.” b.

Set Select Media Database to the database you want to use.

c.

Click the Synchronize button to transfer the existing media to the newly selected database.

d.

Enter the Environment Update Time in seconds.

5.

When complete, click the Save Config button.

Accessing Media from a Database

When the customer opens the store page, its browser requests the HTML code and the media specified in the HTML code from the Magento system. The system searches the requested media in the file system and passes it to the browser, if it is found. If the system does not find the media in the file system, it requests the media from the database specified in the settings, places the media to the file system, and sends it to the customer’s web browser.

To get the files from the database to the file system on the web server a PHP script is used. When the browser requests media from the web server, there are two alternatives for when a PHP script is run: l l

If web server rewrites are enabled in the Magento system and supported by the server, the PHP script is run only when the requested media is not found in the web server file system.

If web server rewrites are disabled in the Magento system or not supported by the server, the PHP script is run in any case, even when the required media exists in the file system of the web server.

You can configure web server rewrites in System > GENERAL > Web > Search Engine

Optimization > Use Web Server Rewrites.

Using a Content Delivery Network

Storing media files in a CDN is another alternative supported in Magento. There is no full integration with a specific CDN, and you are responsible for choosing and configuring a CDN on your own. After configuring the CDN, you must complete the

Magento Community Edition: User Guide

Chapter 60: Alternate Media Storage Using a Content Delivery Network configuration from the Admin. The changes can be made at either the global or website level.

To configure a content delivery network:

1.

On the Admin menu, select System > Configuration .

2.

In the panel on the left, under General, select Web .

3.

Set the Current Configuration Scope as needed.

4.

Click to expand the Unsecure section. Then, do the following:

Unsecure a.

Change the value of the Base Media URL .

b.

Change the value of the Base JavaScript URL .

5.

Click to expand the Secure section.

Secure a.

Change the value of the Base Media URL .

b.

Change the value of the Base JavaScript URL .

6.

When complete, click the Save Config button.

Magento Community Edition: User Guide 669

Using a Content Delivery Network Chapter 60: Alternate Media Storage

Accessing Media from a CDN

When a CDN is selected as media storage, all paths to media on the web store pages are changed to paths to the CDN. Retrieving media that is stored in a CDN works as follows: l l l

When a customer opens a page in the store, the browser addresses the CDN with the request to acquire some media files, such as images.

If the CDN does not yet have these images in its storage, it requests them from the server, and provides images to the customer’s browser.

If the CDN already has the required images in storage, it simply serves the requested images to the customer's browser.

Important! When a CDN is used as media storage, JavaScript may not function properly if the CDN is not in your subdomain. This is a browser security feature.

670 Magento Community Edition: User Guide

advertisement

Was this manual useful for you? Yes No
Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Download PDF

advertisement

Table of contents