Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Bash one-liner to run nginx on command line as regular user to serve files from current directory (a replacement for python -m SimpleHTTPServer)
T=`mktemp` P=`mktemp` && bash -e -c "exec 3<$T && exec 4>$P && rm $P && echo -e 'daemon off;worker_processes auto;pid /dev/null;error_log /dev/stderr;events {} http { access_log /dev/stdout; include /etc/nginx/mime.types; server { listen 127.0.0.1:8000; location / { autoindex on; autoindex_exact_size off; root .;} }}' > $T && rm $T && exec nginx -p . -c /dev/fd/3"
@asterite3

This comment has been minimized.

Copy link
Owner Author

@asterite3 asterite3 commented Mar 6, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment