Created
March 6, 2019 16:43
-
-
Save asterite3/4b9159b8bfcdf9ad8def88168d28b60e to your computer and use it in GitHub Desktop.
Bash one-liner to run nginx on command line as regular user to serve files from current directory (a replacement for python -m SimpleHTTPServer)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
As a (more readable) bash script: https://gist.github.com/asterite3/89236d1753a669e173531aca4b87afdc