Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Nginx rewrite rule guide

Tags:

nginx

I am totally newbie on NGINX reverse proxy solution and its seems to getting hard to understand all the terminology. I am looking for a solution as follows. I would really appreciate anybody's help to configure the same.

We have an internal web server which we would like to publish at WWW site but don't want customer to see internal server URL. As example:

Customer access www.mycompany.com/track --> NGINX read the track and then redirect URL to internal server.com.au/tracker . We dont want customer to see this address.

Any suggestion?

Cheers,

Sandy

like image 902
user2580251 Avatar asked Apr 30 '26 07:04

user2580251


1 Answers

It is much better in this case to use the proxy. Rewrites are meant for URLs within the same domain or to redirect the client (which would show in the url). Try this:

location / {
    proxy_pass http://internal.example.com/;
    proxy_set_header Host $host;
}

Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!