Simple Servers

Quick to start servers.

Python HTTP

# Start python http server on port 80
python -m http.server 80

Python HTTPS

# Create SSL certificate
openssl req -new -x509 -keyout localhost.pem -out localhost.pem -days 365 -nodes

# Start python server on port 443
python3 -c "import http.server, ssl;server_address=('0.0.0.0',443);httpd=http.server.HTTPServer(server_address,http.server.SimpleHTTPRequestHandler);httpd.socket=ssl.wrap_socket(httpd.socket,server_side=True,certfile='localhost.pem',ssl_version=ssl.PROTOCOL_TLSv1_2);httpd.serve_forever()"

FTP Server

# python2
python -m pyftpdlib -p 21

SMB Server

# Start SMB Server
# smbserver.py share /root/share/ -smb2support 
smbserver.py <SHARENAME> <DIRECTORY>
# Confirm server is running (Linux)
smbclient -L <IPADDRESS> --no-pass
# Confirm server is running (Windows)
net view \\<IPADDRESS>

PHP Server

php -S 0.0.0.0:8000

Ruby

ruby -run -e httpd . -p 8000

Busybox

busybox httpd -f -p 8000

Last updated