Nginx rewrite if file not found</h1>
Если картинка не найдена в текущем локации – реврайт на запасную
location /pictures {
root /var/hosting/;
autoindex_exact_size off;
autoindex off;
try_files $uri @pictures2 ;
}
location /pictures2 {
root /var/hosting/;
autoindex_exact_size off;
autoindex off;
}
location @pictures2 {
rewrite ^/pictures/(.*) https://itc-life.ru/pictures2/$1 break;
}
Для proxy_pass
location /uploads/calls/ {
proxy_pass http://nginx-backend:80/uploads/calls/;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_connect_timeout 120;
proxy_send_timeout 120;
proxy_read_timeout 180;
proxy_intercept_errors on;
error_page 404 = @asterisk_2;
}
location @asterisk_2 {
proxy_pass http://10.26.0.35:85;
}