Answer the question
In order to leave comments, you need to log in
How to proxy files on another site in nginx?
I'm moving to php-fpm
There are image urls on the page in the form https://site1.me/i/img/img.site2.ru/cat1/cat2/cat3...
The actual address of the image is img.site2.ru/cat1/cat2 /cat3/picname.big.jpg which is actually the url
It should be shown as if the pictures are on site1
On Apache, everything worked through the .htaccess file in the /i/ folder
With the following content:
RewriteEngine on
php_value default_socket_timeout 1
RewriteRule "^img/(. *)$" " http://$1 " [P]
RewriteRule "^imgs/(.*)$" " https://$1 " [P]
Thanks in advance!
Answer the question
In order to leave comments, you need to log in
nginx.org/ru/docs/http/ngx_http_core_module.html#r...
location ~ ^/i/imgs?/(.*)$ {
resolver 8.8.8.8;
proxy_pass https://$1;
}
location ~ ^/i/imgs?/img\.site2\.ru/(.*)$ {
proxy_pass https://img.site2.ru/$1;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question