Skip to content

Miguell-J/TinyWeb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

TinyWeb Server

TinyWeb Banner

Overview

TinyWeb is a simple HTTP web server written in C that handles basic HTTP requests on port 80 and serves static files from a configurable directory (./webroot).
It’s perfect for learning and experimenting with sockets, file handling, and network programming in C.


Features

  • Handles HTTP GET requests on port 80
  • Serves static files from the webroot directory
  • Supports sequential multiple connections
  • Returns 404 responses for missing files
  • Minimalistic, straightforward, and easy-to-understand implementation

Requirements

  • Compatible C compiler (gcc, clang)
  • Unix-like system (Linux, macOS) recommended
  • Network configured to allow connections on port 80

Installation

Clone the repository and compile:

git clone https://github.com/yourusername/tinyweb.git
cd tinyweb
gcc -o tinyweb tinyweb.c

Usage

Run the server as root (port 80 requires elevated privileges):

sudo ./tinyweb

The server will start listening for HTTP connections on port 80. Place your HTML files and other resources inside the webroot folder.


Testing

Open your browser and visit:

http://localhost

You should see the index.html file served from the webroot directory. If it does not exist, a 404 response will be returned.


Customization

  • Change the port and root directory by editing the macros at the top of main.c.
  • Add support for multiple MIME types for different file extensions.
  • Implement threading for concurrent connections.

Contributing

Contributions are welcome! Fork the repo, add your feature or fix, and submit a Pull Request.


Contact

Miguel Araújo Julio LinkedIn | GitHub | [email protected]


Thank you for checking out TinyWeb! Feel free to reach out with questions, suggestions, or collaboration ideas.

About

TinyWeb is a simple web server written in C that serves basic HTTP requests on port 80 and serves static files from a configurable directory

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors