G
G
Ganjubas_Original2018-03-22 11:19:26
Nginx
Ganjubas_Original, 2018-03-22 11:19:26

Is it possible to pull images for a site from a remote server?

There is a site in production on the server. There is a copy of it on the local server, but without the images folder. She weighs a lot. Is it possible to force the local server to pull pictures from a remote server? That is, we take the relative path of the image /images/(.*) and follow it to the remote site https://my-site.ru/images/(.*).

Answer the question

In order to leave comments, you need to log in

5 answer(s)
A
Andrey Burov, 2018-03-22
@Ganjubas_Original

in nginx

location /images/ {
    proxy_pass https://my-site.ru/images/;
}

O
Oleg, 2018-03-22
@politon

can

V
Viktor Taran, 2018-03-22
@shambler81

there are a lot of options
from synchronization to proxying with the help of nginx, everything has its pros and cons

A
abroabr, 2018-03-22
@abroabr

possible, but not necessary.
it is possible for the user to give at once from a remote server. it will be much more productive.
the web client (browser) does not care that the entire site is displayed from one server or that parts of the page are pulled up from 10 servers at once.
you can pass it through the server (then it will actually be a reverse proxy). but this is an extra load on the communication channel. after all, you most likely have a server with one single physical network interface? that is, the server will take the picture via the same communication channel and send the picture to the client via the same communication channel. not only will the channel speed be 2 times lower (you will be able to serve 2 times less clients from this server), the client will also have an extra delay, which search engines do not like so much now.

O
Oleg, 2018-03-22
@402d

I would leave assets locally to be able to somehow cut the site offline.
and upload can be added to .htaccess like this

RewriteEngine On
 RewriteRule ^upload(.*)$ https://yousite.ru/upload$1 [R=301,L]

дальше исходный

the main thing is not to pour it on the real one by mistake

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question