Rick Cogley's Tech Logr

Short Technical Laser Bursts %%

RC Logr 20200510 174559

Sunday, 10 May, 2020

Many static site generators like Hugo have a built in dev web server. If you are just building some html with css, and need a simple solution to serve the files from any folder, you have a few solutions. See a couple of options:

Node.js users can install and run http-server:

1
2
3
4
npm install -g http-server
cd /path/to/my/working/folder
http-server --help
http-server

Visit http://localhost:8080 and look at the help to change the port.

Python 3 users can run:

1
python -m http.server 8080

Or with php:

1
php -S localhost:8080

Then if you use zsh put it in a function in your ~/.zshrc:

1
2
3
function serve-it (){
  php -S localhost:8080
}

RC Logr 20200510 174559 - Many static site generators … Rick Cogley
Back to Home Tweet Link