Hi,
I'm new on nginx and I want to implement a particular configuration.
I set up a redirect URL http://mydomain.com/images/test/v1/03760089810361_D1C1_s89.jpg
to the URL http://anotherdomain.com/permalink/v1/1/4/preview/03760089810361_D1C1_s89.jpg?token=Ck8fP9xe
All this keeping the first URL.
To do this, I use the following configuration works properly :
server {
listen 80;
access_log /var/log/nginx/test.log;
server_name mydomain.com;
location /images/test/v1/03760089810361_D1C1_s89.jpg {
proxy_pass http://anotherdomain.com/permalink/v1/1/4/preview/03760089810361_D1C1_s89.jpg?token=Ck8fP9xe
}
}
I would like to use variables on the first URL to inject in the second.
So I could have a configuration of this type however, this one does not work :
server {
listen 80;
access_log /var/log/nginx/test.log;
server_name mydomain.com;
location /images/test/$1/$2 {
proxy_pass http://anotherdomain.com/permalink/$1/1/4/preview/$2?token=Ck8fP9xe
}
}
Can you give me the good configuration ?
Regards,
I'm new on nginx and I want to implement a particular configuration.
I set up a redirect URL http://mydomain.com/images/test/v1/03760089810361_D1C1_s89.jpg
to the URL http://anotherdomain.com/permalink/v1/1/4/preview/03760089810361_D1C1_s89.jpg?token=Ck8fP9xe
All this keeping the first URL.
To do this, I use the following configuration works properly :
server {
listen 80;
access_log /var/log/nginx/test.log;
server_name mydomain.com;
location /images/test/v1/03760089810361_D1C1_s89.jpg {
proxy_pass http://anotherdomain.com/permalink/v1/1/4/preview/03760089810361_D1C1_s89.jpg?token=Ck8fP9xe
}
}
I would like to use variables on the first URL to inject in the second.
So I could have a configuration of this type however, this one does not work :
server {
listen 80;
access_log /var/log/nginx/test.log;
server_name mydomain.com;
location /images/test/$1/$2 {
proxy_pass http://anotherdomain.com/permalink/$1/1/4/preview/$2?token=Ck8fP9xe
}
}
Can you give me the good configuration ?
Regards,