Store images and other static content on subdomain.
I want to store images and other static content on subdomain.
My main site works on www.domain.com and I want to store images on static.domain.com
So How can I store images on subdomain in Laravel.
I also want to access css , js file from static.domain.com
Thanks.
Depends what your structure is like. You can set an A record for the subdomain, point it to your server IP then direct that to where you want to serve the files from (document root/root).
@bashy. Thanks for your reply.
I am talking about upload image on sub domain , access image and manipulating it for creating thumbnail.
Currently I am using '../../subdomain/uploads/images' in my controller.
Is there any other clean way to do that?
You could store them on Amazon S3 or some other CDN type service. Ideally these assets would not be stored on the same server, as some of the benefits of a CDN are kind of lost. I have something like this where I also have a function I use to wrap the URL's of these assets. If I need to drop the CDN for whatever reason I can change a setting and instantly have them read locally if needed.
As far as I know you should be able to use a folder in the root of your project e.g. public/static Then have subfolders for your images, css, js, etc. You can then upload/compile assets as per-normal
Create a virtual host for assets.yourdomain.com and point to /public/static
@Shovels
As you suggest I have a folder public/static
But when i have to access images for creating thumbnail , Currently I access image like '../../static/images' from controller. Is there any cleaner way to access images. I don't want to use relative path.