A lightweight and user-friendly HTTP server written in Go that allows you to serve files from the current directory. With customizable ports and simple installation, WebServ is the perfect tool for quick and efficient file serving.
- Simple to Use: Serve files from the current directory with a single command.
- Customizable Port: Change the port easily using the
-port
flag. - Port Persistence: Remembers your last used port for convenience.
- Graceful Shutdown: Close the server with
CTRL+C
. - Cross-Platform: Works on Linux, macOS, and Windows.
Install WebServ directly from GitHub using go install
:
go install github.com/fernstedt/webserv@latest
Ensure your
GOPATH/bin
is in yourPATH
to usewebserv
globally. If not, you can add it with:export PATH=$PATH:$(go env GOPATH)/bin
Run WebServ with the default port (8080):
webserv
Set a custom port (e.g., 9090):
webserv -port=9090
The server will remember this port for future runs.
Once running, you can access the server in your browser:
http://<your-ip>:<port>/
For example:
http://192.168.1.100:8080/
Press CTRL+C
in the terminal to stop the server gracefully.
When running the server, you will see:
Serving HTTP on 192.168.1.100 port 8080 (http://192.168.1.100:8080/)
Run webserv with -port <port> to select any port.
(Close with CTRL+C)
To contribute or modify the project, clone the repository:
git clone https://github.com/fernstedt/webserv.git
cd webserv
Build the project locally:
go build -o webserv
Run the binary:
./webserv
Contributions are welcome! Feel free to open an issue or submit a pull request for bug fixes, improvements, or new features.
###🚀