This page was exported from phaq
[ http://phaq.phunsites.net ] Export date: Thu Apr 25 18:01:37 2024 / +0000 GMT |
Mac OS X (since 10.5) sports a python environment in it's default install, which includes a very simple HTTP server. This may come in handy if you want to serve some files quickly over HTTP, without the need to fireup the full-blown Apache available through 'Web Sharing Service'. Don't believe me? Read on to see how you'll be up in running in just a few seconds. To launch the simple HTTP server, start a Terminal first, then change to the directory containing the files you want to serve, e.g. your Downloads folder:
Now fire up the web server like this:
This will bind to port 8000 by default. To use another port, just give the TCP port as an additional argument on the command line:
To access the server, open the link as http://Your-Macs-IP-Address:8000 (or http://Your-Macs-IP-Address:8100 for the second example). This will provide you with a simple file list to browse and access your files. You won't be able to bind to the HTTP default port 80 with regurlar user accounts however. This will only yield a "socket: [Errno 13] permission denied" error message. To bind to port 80, you need to run the command through 'sudo' like this:
The server will stay in foreground of the Terminal and keep running until you hit CTRL-C. If you want to know why I needed this, then read on my efforts on upgrading Squeezebox Radio firmare. |
Powered by [ Universal Post Manager ] plugin. HTML saving format developed by gVectors Team www.gVectors.com |