百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
B

boxcars-archived

> 编程语言
开源

基于 Go 编写的易于配置的静态 Web 和反向代理服务器

624 stars0 点赞0 次浏览
访问官网GitHub

工具介绍

基于 Go 编写的易于配置的静态 Web 和反向代理服务器

No more maintained

It turns out, this is not a good idea and I don't maintain this project anymore.

Boxcars

Easy-to-configure Static Web/Reverse Proxy Server in Go.

  • Install
  • Usage
  • Configuration Examples
  • Security
  • Logging
  • Benchmarks
  • Troubleshooting
  • TODO

Install

bash
$ go get github.com/azer/boxcars/boxcars

Works with Go v1.1+

Usage

Create a configuration file (it'll be auto-loading changes once you start) like the below example;

json
{
  "foo.com": "/home/you/sites/foo.com",
  "*.bar.net": "localhost:8080",
  "qux.org": {
    "/static": "/home/you/qux.org/static",
    "/favicon.ico": "/home/you/qux.org/static/favicon.ico",
    "/": "localhost:3000"
  }
}

And start the server:

bash
$ boxcars config.json

To specify the port:

bash
$ boxcars -port=8001 config.json

Always enable secure mode when running as sudo:

bash
$ sudo boxcars -port=80 -secure config.json

You can change the configuration anytime during boxcars running. It'll be watching your file and reloading it only if it parses with no error.

Configuration Examples

I use below configuration for a static single-page app that connects to an HTTP API:

json
{
  "singlepage.com": {
    "/api": "localhost:1337",
    "*": "sites/singlepage.com"
  }
}

To catch any domain:

json
{
  "foo.com": "localhost:1234",
  "*": "/home/you/404.html"
}

To set a custom 404 page for a static server:

json
{
  "foo.com": {
    "/": "/home/you/sites/foo.com",
    "*": "/home/you/404.html"
  }
}

Security

Once you enable -secure, boxcars switches from root user to a basic user after starting the server on specified port.

bash
$ sudo boxcars -port=80 -secure example.json

UID and GID is set to 1000 by default. Use -uid and -gid parameters to specify your own in case you need.

Logging

Boxcars uses debug for logging. To enable logging for specific modules:

bash
$ DEBUG=server,sites boxcars config.json

To see how boxcars setup the HTTP handlers for your configuration;

bash
$ DEBUG=handlers-of,sites boxcars config.json

To enable very verbose mode (not recommended):

bash
$ DEBUG=* boxcars config.json

To silentize:

bash
$ DEBUG=. boxcars config.json

It'll be outputting to stderr.

Benchmarks

  • Nginx VS Boxcars

Troubleshooting

The "Too Many Open Files" Error

Boxcars creates a lot of files on /proc/$pid/fd. In case you see boxcars crashing, you can see how many files are open by;

bash
$ sudo ls -l /proc/`pgrep boxcars`/fd | wc -l

To find out your personal limit:

bash
$ ulimit -n

To change it:

bash
$ ulimit -n 64000

You can change soft - hard limits by editing /etc/security/limits.conf.

TODO

  • Add -daemon option.

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Go

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言