It is designed to serve static websites and run PHP applications without requiring a full web server stack such as Apache or Nginx.
- π Lightweight Python HTTP server
- π Static file hosting
- π PHP CGI support
- π Automatic
index.htmlandindex.phpdetection - π Basic path traversal protection
- π‘οΈ Protected file path handling
- β Custom error pages
- π¦ Automatic PHP setup
- π MIME type detection
- π§΅ Multi-threaded client handling
- β‘ Simple and easy to configure
- πͺ Windows support
/
βββ server.py
βββ server.conf
βββ www/
β βββ index.html
β βββ index.php
βββ errors/
β βββ 403.html
β βββ 404.html
β βββ 429.html
β βββ 502.html
βββ README.md
- Python 3.8+
- Windows
- PHP CGI (
php-cgi.exe) for PHP support
python server.pyThe server will start on:
http://localhost:80
If port 80 requires administrator privileges, change the port in server.py:
PORT = 8080Then open:
http://localhost:8080
supports PHP through PHP CGI.
Configure the PHP CGI executable in:
PHP_CGI = r"C:\xampp\php\php-cgi.exe"If PHP is not found, the server can automatically download and configure a PHP package.
Place your website inside the www directory:
www/
βββ index.html
βββ style.css
βββ script.js
βββ index.php
includes basic security protections such as:
- Path traversal prevention
- Unsafe path detection
- Query string validation
- CRLF request protection
- Restricted document root
- Safe PHP execution environment
is intended to be a lightweight development and personal hosting server. For production environments, a hardened web server such as Nginx or Apache is recommended.
Server: ByteWebServer/1.1
X-Powered-By: ByteWebServerBasic configuration can be changed directly in server.py:
HOST = "0.0.0.0"
PORT = 80
WWW_DIR = "www"
PHP_CGI = r"C:\xampp\php\php-cgi.exe"| Option | Description |
|---|---|
HOST |
Server bind address |
PORT |
HTTP port |
WWW_DIR |
Website root directory |
PHP_CGI |
PHP CGI executable |
- HTTP/1.1 improvements
- Keep-Alive support
- Better request parsing
- Access logs
- Configuration file support
- HTTPS support
- Virtual hosts
- Upload support
- Better PHP CGI handling
- Rate limiting
- Admin dashboard
This project is open-source. See the LICENSE file for details.
A simple Python web server for everyone.