New on LowEndTalk? Please Register and read our Community Rules.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
Comments
Thanks for letting us know. How may LowEndSupport be of assistance to you?
I really didn't found any answer to this query out anywhere else. I've seems similar questions here. Anyways, let's remove this
Well, there was no question in your post, and I'm not even sure what your issue was (don't you know how to add a virtual host?). If you want people to help you, put some effort into formulating a proper request.
Thanks edited my question
Are you using a CMS?
I'll using WordPress but my question is not to do it via that way. I want url to auto map to cdn from server while not changing it through cms or code.
In apache, use a redirect or rewriterule directive to redirect queries from the main site to the cdn.
Redirect will add more extra weight to load time
I'm not sure then. I use WordPress on my website but just use a plugin to redirect my images to the CDN I use (adds cdn. before main site domain), works without issue and it does it automatically for most static files and new images I post / upload. No need to edit any code either.
don't redirect, just use proxy pass (http://nginx.org/en/docs/http/ngx_http_proxy_module.html)
Thanks, I'll give a try
Do you understand what a CDN is for? Am I missing something?
It cannot be done without changing the URLs, DNS has no knowledge of HTTP paths. Proxy pass is definitely not what you want, it adds extra latency to requests.
You really don't want to do it with a proxy pass. You might as well not use a CDN in that case.
If you want to make it super simple, set your CDN to pull from example.com (your main site) then use something like w3 to rewrite the URLs for you.
Then just use a cache like redis to further speed things up.
If you've got a few VPSes in, say, three or four locations then simply setup some type of script, alternatively use rsync or git and configure it all so that it only sends any changed/modified files to the VPSes, then add a CNAME (e.g
static.domain.tld
, or evencdn.domain.tld
), and you're pretty much done. All you'd have to do is to integrate the end result for your website.If you're using WordPress you could cheat and use W3 Total Cache which has this type of functionality as a feature. But of course, this adds bloat.
I think OP needs help with the 'All you'd have to do' part...
Nah, just some clues will be more than enough!
If i understand right you need just src= link location to be replaced with remote 'link'. (This if your servers are sync). So maybe you can find a plugin/setting to do this.
Or when you create your sync script between server->"cdn" , you can add something like https://pastebin.com/5JsRNZUk.
So if your server is not sync yet data will be from main server at begin I do not believe that's professional but works..