Most people who do web development would already have some sort of local web server to do their development and testing with but if you’re getting started or want to experiment and follow a tutorial online then you might just want a simple, easy to use web server you can start and stop as required.
So here are four options you should consider.
Node.js
Node.js has a http-server package that can be used to run a simple local web server. If you’ve got node installed open a command line at the directory your content is in.
Installing the Node.js http-server is simple.
npm install http-server -g
This will install the http-server package globally. Now we can start the server to serve the files in the current directory.
http-server . -p 8000
We’re executing the http-server Node.js application, giving it a dot to indicate it is to serve files from the current directory (this could be replaced with a path) and using -p 8000 to tell the server to run on port 8000
You should then be able to access it using localhost:8000 in your web browser.
To stop the server when finished you can just press Ctrl+c in the terminal.