Reverse-Proxy for Outside Resource

I would like to follow this guide:

https://www.linode.com/docs/web-servers/nginx/use-nginx-reverse-proxy/

But instead of proxying localhost, I would like to proxy an outside URL such as https://example.com/xyz. Can this be done?

The effect I want to achieve is that the subdomain https://abc.example.com shows the same content as https://example.com/xyz

I just want to know if I'm on the right track using the reverse proxy method, or if there's a more sane way of doing this? Perhaps using rewrites in apache2. Thanks for your advice.

2 Replies

Hey,

I've done some research into your questions, and I found a couple of links that sound like they're trying to reach the same end goal that you are. I can't say for certain that any of these are better than your plan, but hopefully some options will allow you to consider a variety of tactics before diving into your project!

https://serverfault.com/questions/696920/nginx-redirect-folder-to-subdomain

https://serverfault.com/questions/396034/nginx-rewrite-rule-subdirectory-to-subd

https://stackoverflow.com/questions/38246143/rewriting-subfolder-to-subdomain-without-redirect-with-nginx

I hope one of those links prove helpful and that your proxy redirecting is successful!

Thanks for your reply :) Appreciate the insight.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct