https://github.com/cemeyer/httpd.sh
A trivial web server in bash
https://github.com/cemeyer/httpd.sh
Last synced: 7 months ago
JSON representation
A trivial web server in bash
- Host: GitHub
- URL: https://github.com/cemeyer/httpd.sh
- Owner: cemeyer
- License: mit
- Created: 2015-08-18T01:17:33.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2015-08-24T15:05:24.000Z (over 10 years ago)
- Last Synced: 2025-07-06T08:42:09.043Z (8 months ago)
- Language: Shell
- Size: 250 KB
- Stars: 120
- Watchers: 4
- Forks: 9
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-bash - httpd.sh - A trivial web server in bash, using ctypes.sh. (Downloading and Serving)
README
httpd.sh
========
Httpd.sh is a dumb web server written in Bash. It uses the
[ctypes.sh plugin](https://github.com/taviso/ctypes.sh/) to access C socket
and file APIs. It uses a single-threaded event loop model. It can serve
small files. It does limited error-checking and should not be used in the
wild.
Usage
=====
```bash
$ cd /var/www
$ bash path/to/httpd.sh 8888
httpd.sh: Listening on :8888...
```
Httpd.sh serves files accessible from the directory it was started in. Note
that it is trivial to escape the document root unless you run it in a jail or
chroot.
Platforms
=========
Httpd.sh runs on Linux and FreeBSD using mostly POSIX-standard C APIs (sendfile
excepted). It may work on other Unix / near-POSIX platforms with little
adaptation.