I have been really busy the past 3 days so there were no posts. So there is going to be 3 unrelated small posts on small utilities I use. First thing is a http-server. Since web browsers are locked down these days, it is not easy to read files off local machine when you are testing even a simple website. For example, If I have a html file where I want to load a csv, parse it and display it, serving the html from a http server is the only way to allow a chrome/ Firefox to read the file. At the same time, I really don’t want to install a fullĀ Apache wen server to serve two html files.
The solution to this is a node package – ‘http-server’. It is a tiny http server which when run from a folder in CLI, serves the folder contents as a http-host at localhost. All we need to do is,
# Install nodejs and node package manager (npm) sudo pacman -S node npm # Install http-server package through npm globally npm install -g http-server # start the server http-server
That is it! whichever folder you ran http-server would be accessible at the ip/port shown. we can combine this with forever (another node package) or run under a gnu-screen session to keep it in the background.
If you have python installed (should be the case with most linux distros by default) you get an http server for free – just run ‘python -m SimpleHTTPServer’.
Great blog here! Additionally your website rather a lot up very fast! What web host are you the usage of? Can I am getting your affiliate hyperlink to your host? I want my website loaded up as fast as yours lol
This is just a simple local server which is available on just on the machine where it is run from (and the local network). To have a server which is accessible from everywhere, you might have to get a virtual private server (VPS, which is just an empty computer running on the cloud) and run your own server from there. I have bought couple of VPS from here https://www.ovh.co.uk/
You actually make it appear really easy together with your presentation but I in finding this topic to be actually something which I feel I might never understand. It seems too complex and very broad for me. I’m taking a look ahead on your next submit, I will try to get the hold of it!
If you are on windows and starting to learn about web servers, then this might explain things better https://www.youtube.com/watch?v=DFmPg_qWxA8