# Best Ubuntu+Nginx Reverse Proxy setup?

**URL:** <https://community.fly.io/t/best-ubuntu-nginx-reverse-proxy-setup/41>\
**Category:** General\
**Created:** [July 29, 2020, 8:56pm UTC](https://community.fly.io/t/best-ubuntu-nginx-reverse-proxy-setup/41 "2020-07-29T20:56:41Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![mike](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/mike/32/26_2.png) [@mike](https://community.fly.io/u/mike)\
**Post date:** [July 29, 2020, 8:56pm UTC](https://community.fly.io/t/best-ubuntu-nginx-reverse-proxy-setup/41/1 "2020-07-29T20:56:42Z")

</div>

Hi Everyone!

I’m looking for a Fly optimized nginx Reverse proxy set up. I know I can just use a Ubuntu+Nginx docker image, or even just build one myself, but I’m looking for any best practices or tips on how best to configure Fly as a caching reverse proxy for my project.

I’m using `flyctl` in production already and am familiar with all it provides. We’re using the Fly Certificates for SSL generation as well, so no need to generate SSL inside the image.

Side topic: Any recommendation on using Caddy as a Caching Reverse Proxy instead of Nginx?

Thanks!

---

<div class="post-metadata">

**Author:** ![kurt](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/kurt/32/43757_2.png) [@kurt](https://community.fly.io/u/kurt)\
**Post date:** [July 30, 2020, 6:16pm UTC](https://community.fly.io/t/best-ubuntu-nginx-reverse-proxy-setup/41/2 "2020-07-30T18:16:43Z")

</div>

We have a _very_ basic nginx example here: [https://github.com/fly-examples/edge-nginx](https://github.com/fly-examples/edge-nginx)

_Now_ we think that we should have good examples for larger nginx use cases, probably using OpenResty: [https://fly.io/docs/app-guides/openresty-nginx-plus-lua/](https://fly.io/docs/app-guides/openresty-nginx-plus-lua/)

This is an important part of a full stack image service, too. I’d rather write TypeScript but nginx + lua is incredibly powerful.

---

<div class="post-metadata">

**Author:** ![bcjordan](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/bcjordan/32/2184_2.png) [@bcjordan](https://community.fly.io/u/bcjordan)\
**Post date:** [July 23, 2023, 4:27pm UTC](https://community.fly.io/t/best-ubuntu-nginx-reverse-proxy-setup/41/3 "2023-07-23T16:27:59Z")

</div>

I’m curious if there are any better alternatives for this now, or how complex an OpenResty `Dockerfile`/`fly.toml` might be 🤔

Totally agree TypeScript proxy logic writing would be awesome. Even some WebWorkers/Wasm limited subset type deal could be interesting.

---

<div class="post-metadata">

**Author:** ![lubien](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/lubien/32/41919_2.png) [@lubien](https://community.fly.io/u/lubien)\
**Post date:** [July 23, 2023, 4:36pm UTC](https://community.fly.io/t/best-ubuntu-nginx-reverse-proxy-setup/41/4 "2023-07-23T16:36:54Z")

</div>

If you need a simple reverse proxy you can use Fly-Replay and let fly proxy handle that for you.

I wrote an example of how to do that with a certain path here: [How to route certain paths to another Fly app without a reverse proxy? Meet Fly-Replay](https://community.fly.io/t/how-to-route-certain-paths-to-another-fly-app-without-a-reverse-proxy-meet-fly-replay/14138)

If you need more complex caching that could also be an interesting starting point. If anything, tell us more about your use case.

---

<div class="post-metadata">

**Author:** ![bcjordan](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/bcjordan/32/2184_2.png) [@bcjordan](https://community.fly.io/u/bcjordan)\
**Post date:** [July 24, 2023, 6:57pm UTC](https://community.fly.io/t/best-ubuntu-nginx-reverse-proxy-setup/41/5 "2023-07-24T18:57:00Z")

</div>

> [@lubien](#):
>
> I wrote an example of how to do that with a certain path here: [How to route certain paths to another Fly app without a reverse proxy? Meet Fly-Replay](https://community.fly.io/t/how-to-route-certain-paths-to-another-fly-app-without-a-reverse-proxy-meet-fly-replay/14138)

Thank you, that did the trick, super cool tool! For some reason the nginx pass approach couldn’t keep up with the traffic (requests were failing on and off) but replay worked quite well. Maybe something to do with a concurrency setting that needed changing.

---

<div class="post-metadata">

**Author:** ![lubien](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/lubien/32/41919_2.png) [@lubien](https://community.fly.io/u/lubien)\
**Post date:** [July 24, 2023, 7:08pm UTC](https://community.fly.io/t/best-ubuntu-nginx-reverse-proxy-setup/41/6 "2023-07-24T19:08:47Z")

</div>

I’m glad it’s working well with Fly-Replay!
