LoginSignup
0
0

More than 5 years have passed since last update.

LocalServer

Posted at

node.js (http-server)

$ npm install http-server -g

Usage

$ http-server [path] [options]

Starting up http-server, serving ./
Available on:
  http://XXX.X.X.X:8080
  http://XXX.XX.X.XXX:8080
Hit CTRL-C to stop the server

Available Options:

-p Port to use (defaults to 8080)

-a Address to use (defaults to 0.0.0.0)

-d Show directory listings (defaults to 'True')

-i Display autoIndex (defaults to 'True')

-e or --ext Default file extension if none supplied (defaults to 'html')

-s or --silent Suppress log messages from output

--cors Enable CORS via the Access-Control-Allow-Origin header

-o Open browser window after starting the server

-c Set cache time (in seconds) for cache-control max-age header, e.g. -c10 for 10 seconds (defaults to '3600'). To disable caching, use -c-1.

Example

$ http-server /htdocs -o

Python (SimpleHTTPServer)

$ python -m SimpleHTTPServer[port]

Example

$ python -m SimpleHTTPServer 8000

PHP (Built-In Web Server)

$ cd ~/public_html
$ php -S localhost:8000 [-t path]

Example

$ php -S 0.0.0.0:8000 -t /htdocs
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0