Nginx like webserver implemented in rust

Do you know any rust project as a nginx like webserver?
I mean a drop-in replacement for nginx?
Nginx is good but it's implemented in C and it's working with lots of untrusted inputs it safe for that purpose? can we implement a better one?
And I mean a completely similar webserver to nginx which works with existing configuration files and the user just need to replace nginx with that and everything working.


I was just thinking about this today too, on the back of the Cloudflare issue (not an nginx issue itself though, per se). It would be a lot of work to reimplement, but probably a fun project. Surprisingly (given its proliferation and being exposed to the wild web), (AFAIK) nginx hasn't had many security issues.

1 Like

the truth is nginx didn't have many security issues but who knows what will happen tomorrow?
I personally use nginx myself and if I know there is a stable and safer software out there which I can use without re configuring all the stuff, I will replace my nginx without doubt.

Right, a safer (by construction) but just as performant alternative would be great. I was merely pointing out that it's somewhat impressive that it hasn't been pwned more :slight_smile:

1 Like

I mean a drop-in replacement for nginx ?

There isn't any. Certainly not drop-in. And one of the problems would be that Nginx supports (and is widely used) on platforms not supported by Rust.

Perhaps not many compared to some of its competitors, but still some. And that list doesn't include many 3rd party modules.

can we implement a better one?

We certainly could.

1 Like

What do you mean by platform? can you give me an example?

I meant CPU architectures: various ARM variants and others. See Redirecting... for a list of things where Rust does work, I am not sure there is a list of architectures where it doesn't, but it wouldn't be small.

1 Like

I think that's not a big deal!
Supporting major and common architecture could be a great starting point.
As rust grows we can grow and support more architectures.

1 Like

This would be a massive undertaking. nginx has a significant number of features. I have thought about this as well, and with the hyper crate getting futures/tokio support soon, this will be even easier. But there is still a serious number of features to implement, so having a drop in replacement could take quite a bit of time.

It might be interesting to collect the most common use cases people have as an initial MVP/feature set and build towards that. I have been considering doing this for a custom layer4/7 router, but have yet to find a reason not to just use nginx...


there is no doubt that nginx is a good webserver and that's not the point!
Rust community need projects that can actually show how powerful is Rust.
this project is a good candidate!


No doubt this would be a lot of fun. I'm not suggesting at all that it wouldn't be an awesome thing to start. I'm for Rust all the things!

I've wanted this myself, and for the specific use case I mentioned. The challenge I have is selling this project at work. I may have a reason to do it that involves implementing health monitors on the router for different nodes. This would be cool because of the ease of implementing state machines in Rust, it would be great for me.

The point I'm making is that if we can collect usecases, we can start working towards a common goal... I've decided to hold off until the hyper integration with tokio stabilizes before starting something like this.


I have started with this goal in mind. I have some opinions that are different from nginx, but I hope to create a compelling alternative.

You can read Initial v0.1.0 release of weldr - a reverse proxy written in Rust for some of my future thoughts.


For a start you can write nginx modules in Rust.

Linking with C programs is where Rust shines, and in nginx the modules are the place where most complex and less-tested code lives. Cloudbleed was caused by a custom nginx module, not the nginx core itself.


Writing nginx modules in Rust might be better than in plain C.
However, without good wrapper of nginx API in Rust, it should be a lot of unsafe code, .
Maybe it could be a starting point of making nginx more safe (writing Rust wrapper for nginx API).


I know @pcwalton has been dreaming of doing this. It'd be a great way to show off Rust and Tokio/Hyper...


I have the same idea for drop-in replacement for Nginx, what would be the languages to be supported?

Perhaps, more like Vert.x to supported a few languages? It will be a huge undertaking.

There is this project

These days there's also GitHub - sozu-proxy/sozu: Sōzu HTTP reverse proxy, configurable at runtime, fast and safe, built in Rust. It is awesome! Ping us on gitter to know more (reverse-proxy), it also seems somewhat actively developed(at the time of posting).

Compared to others which have all not seen any commits in months.


I use Caddy 2 with an adapter for Nginx configs if needed and was wondering if anything like this is written in Rust. I got here. Caddy is written in Golang. Since a lot of security issues are because of the memory problems and Golang uses GC I consider it a bit safer in this area, but a similar Rust project would be really great. Maybe Caddy could be an inspiration for someone :slight_smile:

There are definitely projects where security is more important than performance so even if it would a bit slower from start it would be a great alternative.