Neat trick, but probably too limited to be of much use. Also, stopping it is kind of a nuisance.
Why? It only takes one ^C
Could be an OS-dependent thing. I'm using OS X.
41–50 of 69 posts
If you have python, then these are really useful, just serves up the current directory. Python 2.x: python -m SimpleHTTPServer Python 3.x: python -m http.server 8000
We've used a similar trick to copy files between coworkers: on server: while true; nc -l $PORT $FILE Quick, simple and easy to fire up. You can continue to hack on the file and nc will serve up the latest saved version.
If you have python, then these are really useful, just serves up the current directory. Python 2.x: python -m SimpleHTTPServer Python 3.x: python -m http.server 8000
Or for https (e.g. when developing for Chrome's speech recognition API): twistd --nodaemon web --path=. -c snakeoil.crt -k snakeoil.key --https=8443 And to generate a 100-year localhost key/cert for use with this: openssl genrsa -passout pass:dummy -out snakeoil.secure.key 1024 openssl rsa -passin pass:dummy -in snakeoil.secure.key -out snakeoil.key openssl req -new -subj "/commonName=localhost" -key snakeoil.key -ou…
cat /etc/certs/ssl-cert-snakeoil.pem \
/etc/priv/ssl-cert-snakeoil.key >> \
/etc/priv/ssl-cert-and-key-snakeoil.pem
chmod og-rwx /etc/priv/ssl-cert-and-key-snakeoil.pem
#note instructions above on how to generate a fresh
#self-signed cert
python3 -m http.server 8000 &
stunnel -p /etc/ssl/private/ssl-cert-and-key-snakeoil.pem -r 8000 -d 4430
Which does require stunnel, in addition to python, obviously.Since everyone uses the one line of bash to just start their favourite complex network utility, I'll also contribute mine: while true; sudo /usr/sbin/apachectl start; break; done;
Since everyone uses the one line of bash to just start their favourite complex network utility, I'll also contribute mine: while true; sudo /usr/sbin/apachectl start; break; done;
$ curl localhost:8080 & curl localhost:8080
[...]
curl: (7) Failed connect to localhost:8080; Connection refused
Yes, the server "restarts" after each request, and during the restart, it's not listening.That's not what I would call a "server".