MTWS is a small but useful web server for small projects.
Find a file
RGBToaster 96ecdaaff8
Fixed spelling mistakes
Replaced "mlws" with "mtws"
2025-10-09 05:48:35 +02:00
license.txt Added license.txt 2025-04-08 23:00:19 +02:00
mtws Added main mtws.cpp and compiled version 2025-04-09 00:15:58 +02:00
mtws.cpp Updated Code to v1.1.0 2025-10-09 05:29:55 +02:00
README.md Fixed spelling mistakes 2025-10-09 05:48:35 +02:00

MyTinyWebServer

Status License

MTWS is a small but useful web server for small projects.
(Not intended for real web hosting — for that, I recommend Nginx.)


How to Compile

A compiled version is already included.
However, if you've made changes and want to compile it yourself, follow these steps.

(If you don't want to compile it, just download the mtws.cpp file and place it in your root web folder. Then skip to Step 3.)

1. Setup

Make sure you have the GNU C++ Compiler installed.

Debian/Ubuntu-based:

sudo apt install g++

Arch-Based:

sudo pacman -S gcc

Fedora/RHEL/CentOS:

sudo dnf install gcc-c++

openSUSE:

sudo zypper install gcc-c++

Windows:

  • Install MSYS2
  • Then run: pacman -S mingw-w64-x86_64-gcc

macOS:

  • Install Xcode Command Line Tools:
xcode-select --install

2. Compiling

Clone the repository:

git clone https://github.com/RGBToaster299/MyTinyWebServer.git

Navigate into the new folder:

cd MyTinyWebServer/

Compile the project:

g++ -std=c++17 -o mtws mtws.cpp -ldl

You should now have a compiled binary named mtws.


3. Running the Server

  1. Put the mtws binary into your web folder
    (this folder will be used as the root directory for your website).
  2. Open your terminal (if not already open).
  3. Run the server:
./mtws -p 8080

The server should now be running.

Stopping the Server

Type stop into the console.


Plugins?

Yes, plugin support is planned for MTWS.
However, I'm currently focusing on improving the stability of the core project.


Explorer

MTWS includes a built-in file explorer.
It is shown when the current directory doesn't contain an index.html (or any .html) file.


Port 80 Issues

Port 80 may not work on some systems — this is likely due to:

  • Permission issues (requires root/admin on many OSes)
  • Another process already using the port

This is a known issue, and I'm working on resolving it.
If you manage to fix it, feel free to contribute via pull request or commit!


Supported Platforms

MTWS runns as expected on Linux. Untested on Windows or MacOS.


License

This project is licensed under the
Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
See license.txt for full legal terms or visit the official license page.