Jump to content

[1.5 and 1.4] Configure MEDIA SERVERS with subdomains (in order to separate page requests)


Soek22

Recommended Posts

If you don't have the budget to get a CDN, you can benefit of MEDIA SERVERS in order to divide page request into three subdomains and speed up your web. As I read, a web browser only executes 8 page requests per domain at the same time. So if you divide content on different domains, the browser will be able to execute more request than 8 at the same time.

 

Note that you will not have the principal feature of a CDN, as your content will be still served from the same server. But at least you will be taking advantage of this unused performance.

 

For the media servers configuration of http://www.site.com you have to do:

 

1. Create subdomains (on your server configuration panel, cpanel, plesk or whatever) that points to the same directory where you have installed http://www.site.com (I mean that all subdomains needs to have the same path as root folder that the main domain has).

Subdomain examples:

static1.site.com

static2.site.com

static3.site.com

2. Set that subdomains on each media server field (performance preferences).

3. If you are using SSL on your store and you don't have a wildcard certificate, you have to do the next step in order to don't use media server on https pages:

·PS 1.5 - Follow the next tutorial: http://blog.dh42.com/prestashop-media-server-hack/

·PS 1.4:

You need to add the next condition to the second if statement of the getMediaServer($filename) function (line 1742 aprox.) in "classes/Tools.php"

Tools::usingSecureMode() == false

Here you can see the original if statement:

if (self::$_cache_nb_media_servers AND ($id_media_server = (abs(crc32($filename)) % self::$_cache_nb_media_servers + 1)))
return constant('_MEDIA_SERVER_'.$id_media_server.'_');

So you have to replace "AND" with "&& Tools::usingSecureMode() == false &&":

if (self::$_cache_nb_media_servers && Tools::usingSecureMode() == false && ($id_media_server = (abs(crc32($filename)) % self::$_cache_nb_media_servers + 1)))
return constant('_MEDIA_SERVER_'.$id_media_server.'_');

Sources: HA!*!*Y post and dh42 blog

 

Regards.

Edited by Soek22 (see edit history)
Link to comment
Share on other sites

Hi !

 

I follow this : http://www.prestashop.com/forums/topic/285212-would-this-work-use-media-server-only-on-non-ssl-pages/?do=findComment&comment=1519871

 

I edited the file ine www/classes/Tools.php but i have one problem on contact-form.php and index.php pages.

 

When i'm loading this page on SSL, files in theme/mytheme/img can load because the filepath is https://cdn1.domaine...me/mytheme/img/... Same thing on index.php, images can not be loaded. The

Link to comment
Share on other sites

When i'm loading this page on SSL, files in theme/mytheme/img can load because the filepath is https://cdn1.domaine...me/mytheme/img/... Same thing on index.php, images can not be loaded. The

 

I don't understand what you want to say. I suppose that you haven't configured very well the subdomains and media servers.

 

Can you explain it in other way?

Link to comment
Share on other sites

Hi !

 

I'm sorry, i'm french and i'm trying to do my best for explain my problems :)

 

I set up the file Tools.php as you indicate directly in /www/classes/Tools.php. But when i'm loading the page https

 

So, i look in Firebug, i have two problems :

 

1) all my images in /www/themes/mytheme/img/ are not loaded because the filepath is httpscdn1.mydomain.com/themes/mytheme/img/..... and it should be httpswww.mydomain.com/themes/mytheme/img/..... for working.

 

2) just one css file is not loaded : grid_prestashop.css. The filepath is is httpscdn1.mydomain.com/themes/mytheme/css/grid_prestashop.css and it's not working because we have https://cd1.mydomain.com.

 

I have this two problems in only two pages : httpss

 

If it's still not clear, ask me :)

Link to comment
Share on other sites

  • 2 months later...
  • 4 weeks later...

Hello I have a problem with some paiement modules : they try to go to a "httpss" url !

Ido you know the matter ?

 

can you describe what problems you;ve got exactly?

fact that customers are redirected to https payment gateway pages is not a problem

Link to comment
Share on other sites

My website is www.spotcorse.fr, made with webaccapella which uses the prestashop back office

I just got a ssl certificate and now when someone goes to pay with the "cheques payment" module of prestashop, or with the CB payment module of Be2Bill, it is directed to a 'httpss' page (not 'https') …which of course doesn't exist

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...