Accessing the images folder from different server

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

Post Reply
User avatar
jlising
Forum Commoner
Posts: 33
Joined: Mon Mar 19, 2007 1:48 am
Location: Pampanga, Philippines
Contact:

Accessing the images folder from different server

Post by jlising »

Hi,

I would like to ask if this is possible. I have two hosts,

server1 - web server
server2 - db server

both are in the same vpn. I have a web page in server1 which access the images located in server 2.

example:
<img src="http://server2/images/someimage.jpg">

Is it possible to change the src value to images/someimage.jpg only? What I mean here is the images is physically located at server2 but accessing it like a local folder in server1.

I hope you can suggest a very good setup for this. I don't want to put the ip address of server2 in my scripts.

Regards,
Jess
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Accessing the images folder from different server

Post by requinix »

Use a proxy: have the /images folder pass requests to server2. In the root .htaccess

Code: Select all

ProxyPass /images http://server2/images
Of course the easiest thing would be to move the images. Is that not an option?
User avatar
theserve
Forum Newbie
Posts: 24
Joined: Wed Jan 18, 2012 6:35 am
Location: London

Re: Accessing the images folder from different server

Post by theserve »

you could also consider NFS
Post Reply