Here's a way to quickly set up a temporary webserver to share the contents of the current working directory with others as a directory listing webpage.
Code:
#!/bin/bash
LOGFILE="webserver_log_$(date +%s).txt"
python -c "import SimpleHTTPServer;SimpleHTTPServer.test()" &> $LOGFILE
- [Setup] Save the code snippet as webserver.sh
- [Setup] Make it executable. chmod +x webserver.sh
- [Setup] Put it somewhere in your PATH so that you can use it from any directory.
- Run it: webserver.sh
- Stop it: press Ctrl-C.
- People on your LAN can view it at http://yourhostname:8000
- People across the internet can view it if you set your router to forward the external port 80 to youriporhostname:8000
- You could use DynDns to get a permanent URL for yourself so that you don't have to give people your current IP address (e.g. http://bob.dyndns.org/)
Last edited: