Welcome! Log In Create A New Profile

Advanced

Re: Nginx rewrite issue

Paul
February 20, 2022 12:54PM
On 2022-02-20 8:17 a.m., Dr_tux wrote:
> Hello,
>
> I want to write a rewrite like http://url/index.php?target=server1 and
> http://url/target=server1 in Nginx and I want to use it in reverse proxy.
> This is possible in AWS, but how can I do it in Nginx?
>
> I tried as follows. Not worked.
>
> location = /index.html?target=server1 {
> proxy_pass http://server1;
> }
>
> location = /index.html?target=server2 {
> proxy_pass http://server2;
> }

What do your error logs show?

Maybe the '=' after 'location' is superfluous? Please refer to the
manual at
https://docs.nginx.com/nginx/admin-guide/web-server/reverse-proxy/>.

And for more info on using wildcards in 'location', please see
https://www.nginx.com/blog/regular-expression-tester-nginx/

nginx documentation is pretty good, so start there. If you still have
problems after "read the manual" full details of your server setup and
errors logged would be helpful for others to try and help you.

HTH -- Paul
_______________________________________________
nginx mailing list -- nginx@nginx.org
To unsubscribe send an email to nginx-leave@nginx.org
Subject Author Posted

Nginx rewrite issue

Dr_tux February 20, 2022 08:17AM

Re: Nginx rewrite issue

Paul February 20, 2022 12:54PM

Re: Nginx rewrite issue

OS_Killer February 20, 2022 02:40PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 155
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready