Skip to content

Instantly share code, notes, and snippets.

@hugoheden
Last active February 7, 2022 14:34
Show Gist options
  • Save hugoheden/a91a16b7e1e46dee4f0cc9fe2687df7c to your computer and use it in GitHub Desktop.
Save hugoheden/a91a16b7e1e46dee4f0cc9fe2687df7c to your computer and use it in GitHub Desktop.
A simple one-off nginx: Use nginx in docker to serve a single file without any special configuration.
# This should make your file accessible on http://localhost:9080
# File is given as command line parameter. Expects relative path from current directory.
THE_FILE=$1
# File is served on port 9080.
docker run -it --rm -p 9080:80 -v "$(pwd)/$THE_FILE":"/usr/share/nginx/html/$THE_FILE" nginx:latest
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment