How do I set up the simplest HTTP local server? [duplicate]
Ubuntu ships using python3 as its default, and they have gone to great lengths to make this extremely easy for us :D
To start the http server on port port simply type
python -m http.server port
If you want to share files and dirs, cd into whichever directory you want to serve
cd /my/html/files
python -m http.server 8080
Should you want to use an address other than the default 0.0.0.0
you can use --bind
Ex: python -m http.server 8080 --bind 127.0.0.1
will serve them at the address 127.0.0.1:8080
:)
Edit: Whether or not it truly was great lengths, I'll leave that to the reader
Also for your convenience here is a link to the docs https://docs.python.org/3/library/http.server.html
Here is a list of HTTP server in one line. I'm sure there is one that will fit your purposes/existing tooling.
Hereafter is a subset of the link, that contains in my opinion the most convenient ones.
Python:
python -m http.server 8000
Ruby:
ruby -run -ehttpd . -p8000
Node:
npm install -g http-server
http-server -p 8000
Php:
php -S 127.0.0.1:8000