Quick Linux Tip #48:
Try: python3 -m http.server 8080 --bind 0.0.0.0
Info: Python's built-in HTTP server serves the current working directory over HTTP. --bind 0.0.0.0 makes it reachable across all network interfaces on port 8080.
Examples:
- $ cd /path/to/share && python3 -m http.server 8000 # Share specific directory
- $ python3 -m http.server 8080 --directory /var/www/public # Set dir without cd
- $ npx http-server -p 8080 # Node.js alternative
Note: Never use in production. It lacks authentication, HTTPS, and multi-threading. Press Ctrl+C to stop. Check your firewall settings (ufw) if connection times out.
Leave a Reply