News for hackers. Stuff that matters.

Ask HN: Simple HTTP server for local dev and testing?

I'm looking for a web server to use for local development and testing. My requirements are:

Simple to configure with one config file

Included as a package in most distributions

Supports CGI, access.log, HTTP Basic auth and htpasswd format, SSI, HTTP 1.1, setting expire headers, rewrite rules.

Stable configuration format

I've been using lighttpd for a while, but I am frustrated by its configuration churn. Every couple of version some option becomes "deprecated" with another one to replace it. This results in warnings when I launch it, extra work I have to do to get rid of them, and then managing these changes between all the different lighttpd versions I now have to support.

Does anyone know a good alternative?

( 9 comments | 6 points | on HN )
Re:Ask HN: Simple HTTP server for local dev and testing? by samwillis on Sunday December 19, 2021 @09:19AM (#29614126)
Nginx is super stable and does what you want, I’m not aware of any config options being depreciated.

Or maybe Caddy, keep hearing good things but not used it myself.

Re:Ask HN: Simple HTTP server for local dev and testing? by arpa on Sunday December 19, 2021 @11:20AM (#29615119)
Nginx only supports fastCGI.
Re:Ask HN: Simple HTTP server for local dev and testing? by no_circuit on Sunday December 19, 2021 @08:55AM (#29613958)
Have you considered Apache HTTP Server v2.4.X? I'd expect that the configuration churn would be a lot less with it. It is available in most Unix-like OS distributions, and as well as Windows if that's what you need. The configuration can fit in one file if you inline any of the configuration `Include` directives. Plenty of documentation and tutorials on the Internet for it.
Re:Ask HN: Simple HTTP server for local dev and testing? by gjvc on Sunday December 19, 2021 @08:47AM (#29613892)
as close as possible as to what's used in production
Re:Ask HN: Simple HTTP server for local dev and testing? by Dystopian on Sunday December 19, 2021 @11:52AM (#29615540)
I agree with this ↑

If you want to play with something fun though, Richard Hipp (of SQLite) has althttpd which sparked my interest when I first heard about it - https://sqlite.org/althttpd/doc/trunk/althttpd.md

Re:Ask HN: Simple HTTP server for local dev and testing? by vs4vijay on Sunday December 19, 2021 @08:49AM (#29613906)
caddyserver
Re:Ask HN: Simple HTTP server for local dev and testing? by cpach on Sunday December 19, 2021 @11:14AM (#29615041)
Caddy is a joy to work with. I like it even more than Nginx. The configuration language is very succinct and clear. Automatic HTTPS is included out-of-the-box if you need it (no plugins required).

It’s easy to deploy since it’s a static binary written in Go.

Re:Ask HN: Simple HTTP server for local dev and testing? by joshxyz on Sunday December 19, 2021 @07:44PM (#29620316)
Great reverse proxy

Great configurations

Very nice i like it

Re:Ask HN: Simple HTTP server for local dev and testing? by unbanned on Sunday December 19, 2021 @03:30PM (#29618030)
Apache.