Simple Web Server

simplewebserver.org

174 points by speckx 12 days ago


elcritch - 11 days ago

Cool project! Setting up a quick local HTML server can be annoying.

Alas it looks like it's web/electron based. :/ Downloading it and yep, 443.8 MB on MacOS. The Linux one is a bit better at 183.3 MB.

Electron really should get a kickback from disk manufacturers! ;)

Shameless plug, I've been working on a HTML inspired lightweight UI toolkit because I'm convinced we can make these sort of apps and they should only be ~10-20 MB [1] with nice syntax, animation, theming, etc. I'm finally making a suite of widgets. Maybe I can make a basic clone of this! Bet I could get in < 10MB. :)

1: https://github.com/elcritch/figuro

vince14 - 11 days ago

Because projects like these were missing back then, I got creative with nginx and do not need any config changes to serve new projects:

  server {
    listen 80;
    server_name ~^(?<sub>\w+)(\.|-)(?<port>\d+).*; # projectx-20201-127-0-0-1.nip.io
    root sites/$sub/public_html;
    try_files $uri @backend;
    location @backend {
      proxy_pass http://127.0.0.1:$port;
      access_log logs/$sub.access;
    }
  }
Configuration is done via the domain name like projectx-20205-127-0-0-1.nip.io which specifies the directory and port.

All you need to do is create a junction (mklink /J domain folder_path). This maps the domain to a folder.

Hyperlisk - 11 days ago

This looks nice with a friendly UI. I've been very happy with Caddy[1], but this seems like something I might recommend to someone that is new to the web environment.

[1] https://caddyserver.com/docs/quick-starts/static-files

nipperkinfeet - 11 days ago

Electron? It's unfortunate how bad programming has become. Over 100MB for a program that could be written with native code under 1MB.

dpz - 12 days ago

https://gist.github.com/willurd/5720255

bangaladore - 12 days ago

Should support self-signed HTTPs ideally. IIRC there a quite a few (some?) web features that do not function unless the page is served over HTTPs.

That would certainly make this more useful than `python3 -m http.server`.

nasso_dev - 11 days ago

For those who have Rust, I like miniserve[1]:

    cargo install --locked miniserve
    miniserve path/to/directory
[1]: https://github.com/svenstaro/miniserve
smusamashah - 11 days ago

I use voidtools Everything on windows for instant file lookup. It has an Http server built in. Whenever browser complains about a feature only available via webserver url, not local file, it comes handy. Open everything webserver, enter name of the file and click.

danpalmer - 11 days ago

Tailscale does this, you can serve a port on your Tailnet, or you can serve a directory of files, or you can expose it to the internet. Comes with HTTPS. It's pretty neat.

https://tailscale.com/kb/1312/serve

flessner - 11 days ago

It looks nice and friendly, but for developers I can recommend exploring caddy[1] or nginx[2]. It's a useful technology to have worked with, even if they're ultimately only used for proxying analytics.

[1] https://caddyserver.com/ [2] https://nginx.org/

efilife - 11 days ago

You get a whole copy of chromium doing something a simple python -m http.server would do without the 200MB overhead

Ingon - 11 days ago

For a second there, I read it as static web server [1], which is actually pretty cool itself

1: https://static-web-server.net/

la_fayette - 11 days ago

I often have the requirement, during development cycles, to bring up a static Webserver. After trying several options I always happily come back to the PHP built-in Webserver:

php -S localhost:8080

Many helpful options are available, just check the docs...

astrod - 11 days ago

Bun does this with;

bun index.html

https://x.com/jarredsumner/status/1886073859138580506

kakuri - 11 days ago

npx http-server (keep the "r" at the end, it's more up-to-date than the http-serve package)

https://github.com/http-party/http-server

Defletter - 11 days ago

Seems like most of the people in these comments have missed the point, as while I also lament the use of Electron, pasting one-liner scripts does not obviate the usefulness of this project. Clearly the point of this project is not just about setting up a simple webserver, but to provide a quick and easy gui to configure that webserver, and there's a fair amount that it allows you to configure. Your one-liner that does nothing but pipe static files as a response is not that. If that's all you need, great, then this project is not for you and that's okay.

7bit - 11 days ago

240 MB for a simple web server? You're doing something wrong. And by something, I mean everything.

I_complete_me - 11 days ago

My goto is https://libraries.io/pypi/beautify-http-server; upload files and everything. I have it running on my Raspberry Pi.

sltr - 11 days ago

    docker run --rm -p 8080:80 -v "$(pwd):/usr/share/nginx/html:ro" nginx:alpine
will host the current directory on 8080
perilunar - 11 days ago

Not sure why i need this on Mac. Apache is already installed — just drop your files in ~/Sites/ or /Library/WebServer/Documents/ .

globular-toast - 11 days ago

Wow, this is a "full circle" moment. I can distinctly remember installing my first WAMP (Windows, Apache, MySQL, PHP) stack back in ~03 when I was learning to program. It was all easy point-and-click installers. I think I may have had to edit a config file to enable PHP, but that was it.

bayindirh - 11 days ago

Looks cool! If anyone wants a similar thing without a UI, there's a also webfsd [0]. It's mature, feature packed and fast.

[0]: https://github.com/ourway/webfsd

bsimpson - 12 days ago

If you globally install the npm module dhost, you can run it from any directory (`dhost`) to start a webserver there.

Python 2 had a similar function (`python -m SimpleHTTPServer`). I know there's a Python 3 equivalent, but I don't have it memorized.

dark-star - 12 days ago

cd /some/dir && python -m http.server 8080

pjmlp - 11 days ago

I basically do jwebserver.exe, done.

theonething - 11 days ago

python3 -m http.server 8000