[From] http://www.cnblogs.com/lucker/p/4108838.html

http-server 是一个简单的零配置命令行HTTP服务器, 基于 nodeJs.

如果你不想重复的写 nodeJs 的 web-server.js, 则可以使用这个.

安装 (全局安装加 -g) :

 npm install http-server 

Windows 下使用:

在站点目录下开启命令行输入

 http-server

  

访问: http://localhost:8080 or http://127.0.0.1:8080 

使用于package.json

 "scripts": {
"start": "http-server -a 0.0.0.0 -p 8000",
}

参数 :

-p 端口号 (默认 8080)

-a IP 地址 (默认 0.0.0.0)

-d 显示目录列表 (默认 'True')

-i 显示 autoIndex (默认 'True')

-e or --ext 如果没有提供默认的文件扩展名(默认 'html')

-s or --silent 禁止日志信息输出

--cors 启用 CORS via the Access-Control-Allow-Origin header

-o 在开始服务后打开浏览器
-c 为 cache-control max-age header 设置Cache time(秒) , e.g. -c10 for 10 seconds (defaults to '3600'). 禁用 caching, 则使用 -c-1.
-U 或 --utc 使用UTC time 格式化log消息

-P or --proxy Proxies all requests which can't be resolved locally to the given url. e.g.: -P http://someurl.com

-S or --ssl 启用 https

-C or --cert ssl cert 文件路径 (default: cert.pem)

-K or --key Path to ssl key file (default: key.pem).

-r or --robots Provide a /robots.txt (whose content defaults to 'User-agent: *\nDisallow: /')

-h or --help 打印以上列表并退出 

引用文档: a simple zero-configuration command-line http server

最新文章

  1. DNS简析
  2. Linux 中 Nginx 重启关闭
  3. 移动端浏览器和微信浏览器上禁止body的滚动条
  4. Serializer序列化/反序列化DateTime少了8小时问题解决
  5. Pyqt 窗体间传值
  6. tiny210裸机第1课(启动原理)
  7. eMarketer:DMP帮广告主搞定大数据处理问题
  8. 【PHP入门到精通】:Ch05:字符串处理
  9. overflow之锚点技术实现选项卡
  10. hdu2531之BFS
  11. perl版 Webshell存活检测
  12. Java---hashCode()和equals()
  13. 第27章 联合网关 - Identity Server 4 中文文档(v1.0.0)
  14. H5移动端rem适配
  15. 高性价比 VPS virtwire Host
  16. C#时间戳的简单实现
  17. 浅谈JS的作用域链(二)
  18. PYTHON-文件处理-练习
  19. 【angular5项目积累总结】avatar组件
  20. 一些CSS3的乐趣 - 工作也能发现乐的源头

热门文章

  1. hdu 2206 IP的计算(最全的注意事项)
  2. html5操作类名API——classlist
  3. smartUpload上传下载
  4. js中的arguments 参数
  5. 函数LEN()使用方法
  6. vs2010 does not have a strong name
  7. Window 7 Professional 多语言设置
  8. HTML4.0 需要掌握的主要内容
  9. 数值限制------c++程序设计原理与实践(进阶篇)
  10. 复制构造函数被调用的三种情况------新标准c++程序设计