Very simple Ruby-based webserver. Will read a file (index.html
) and output
the contents, along with the necessary headers.
Note: This is a project for learning, not practical use.
- Ruby 1.8.7+ (not doing anything too complicated here)
Start server with:
ruby server.rb
Then visit this in your browser:
http://localhost:2345
or curl:
curl -i http://localhost:2345
- Allow port to be set as a parameter.
- Handle different file types (jpg, png, gif, zip)
- HTTP Made Really Easy - A Practical Guide to Writing Clients and Servers
- Hypertext Transfer Protocol -- HTTP/1.1 [w3.org]
- Pragmatic Programmers Ruby 1.9 Socket Library Appendix [free supplement to "pickaxe"]
- nweb: a tiny, safe Web server (static pages only) [Web server in 200 lines of code (C)]