Jump to content

Setting up Media Servers, keep images on both locations or not?


Recommended Posts

Hi,

 

I want to use a new VPS as media server to put my static content on.

the problem was I had too many image files on my shared hosting on bluehost (700,000+ images, including thumbnails etc)

So as a result, I have to delete the images after I've copied them to the new server,

but in the Prestashop wiki it is said that:

 

"Reminder: you must make it so that these folders are always synchronized."

 

So, do I have to keep the images on my shared hosting as well? or I can simply move them to the new VPS?

 

Any piece of info or advice is highly appreciated :)

Link to comment
Share on other sites

if you are trying to use media servers, then you need to keep the original files on the prestashop installation server. These act as the primary source, from which the CDN's pull their cache from.

 

Keep in mind that CDN's are only used for the front end, customer facing portion of the website. So if you remove the images from the local prestashop installation folders, then your back office will not show these images. Also, when you add new products, those images will be installed in the base /img folder, and then you would have to copy them over to your VPS server

 

now you could try to create subdomains, like

media1.domain.com

media2.domain.com

media3.domain.com

 

and have these subdomains pointing to your VPS server, where you would have the static cache of the css, js and images.

 

I thought I saw blogs showing exactly how to accomplish this, you should try a google search to see if you can find it.

  • Like 1
Link to comment
Share on other sites

Thanks for the info!

I think I have to forget about the images on backoffice for now, because if I do not delete all those 700,000 images from my shared hosting they'd deactivate my account for using too much server resources!

Link to comment
Share on other sites

Also I have another question, I've tried using media server, copied the /img folder on the VPS and created an redirected the subdomain, however the images won't load, because it looking for the image in this link:

 

http://media1.mysite.com/19609-rect_default/image-name.jpg

 

that is a Friendly URL, but of course the real image is in:

 

http://<that servers IP address>/img/1/5/2/3/image-name.jpg

 

the subdomain will redirect successfully to the VPS IP address and it'll be like:

 

http://<that servers IP address>/19609-rect_default/image-name.jpg

 

which is obviously not true.

 

Disabling Friendly URLs in BO will do the job but I don't really look forward to disabling friendly URLs.

 

Anyone has and idea how to work around this?

  • Like 1
Link to comment
Share on other sites

Thanks for info.

The VPS uses windows 2008 server so I couldn't use htaccess on there, instead I tried to convert the link before they are sent to the VPS by putting an htaccess in the subdirectory of the subdomain, it got me a few tries but finally it worked fine.

Link to comment
Share on other sites

  • 10 months later...

Thanks for info.

The VPS uses windows 2008 server so I couldn't use htaccess on there, instead I tried to convert the link before they are sent to the VPS by putting an htaccess in the subdirectory of the subdomain, it got me a few tries but finally it worked fine.

 

It will be helpfull for me if you can explain how did you do this!!!

 

Thanks!

Link to comment
Share on other sites

  • 1 month later...

Also I have another question, I've tried using media server, copied the /img folder on the VPS and created an redirected the subdomain, however the images won't load, because it looking for the image in this link:

 

http://media1.mysite.com/19609-rect_default/image-name.jpg

 

that is a Friendly URL, but of course the real image is in:

 

 

 

the subdomain will redirect successfully to the VPS IP address and it'll be like:

 

<that servers IP address>/19609-rect_default/image-name.jpg

 

which is obviously not true.

 

Disabling Friendly URLs in BO will do the job but I don't really look forward to disabling friendly URLs.

Anyone has and idea how to work around this?

 

Hi Anyone found a workaround for this.

I've setup a cdn to load images faster, but it works with full url, not with rewritten url

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

  • 5 months later...

 

Hi Anyone found a workaround for this.

I've setup a cdn to load images faster, but it works with full url, not with rewritten

I copied the .htacces from the root of the BO server to the CDN server and changed all the references from img/ to /

Works great now!

  • Like 1
Link to comment
Share on other sites

I copied the .htacces from the root of the BO server to the CDN server and changed all the references from img/ to /

Works great now!

 

Hi, 

 

what do you mean with the changes references, did you change this code in htaccess for example for the same without "img"?

RewriteRule ^([0-9])(\-[_a-zA-Z0-9-]*)?(-[0-9]+)?/.+\.jpg$ %{ENV:REWRITEBASE}img/p/$1/$1$2$3.jpg [L]
  • Like 1
Link to comment
Share on other sites

  • 5 months later...

I copied the .htacces from the root of the BO server to the CDN server and changed all the references from img/ to /

Works great now!

 

Hi, can you please elaborate more on this. Perhaps you can share an exerpt of your htaccess with us here..

  • Like 1
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...