Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Easy-to-configure Static Web & Reverse Proxy Server in Go
Branch: master

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


$ go get

Works with Go v1.1+


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

  "": "/home/you/sites/",
  "*": "localhost:8080",
  "": {
    "/static": "/home/you/",
    "/favicon.ico": "/home/you/",
    "/": "localhost:3000"

And start the server:

$ boxcars config.json

To specify the port:

$ boxcars -port=8001 config.json

Always enable secure mode when running as sudo:

$ 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:

  "": {
    "/api": "localhost:1337",
    "*": "sites/"

To catch any domain:

  "": "localhost:1234",
  "*": "/home/you/404.html"

To set a custom 404 page for a static server:

  "": {
    "/": "/home/you/sites/",
    "*": "/home/you/404.html"


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

$ 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.


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

$ DEBUG=server,sites boxcars config.json

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

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

To enable very verbose mode (not recommended):

$ DEBUG=* boxcars config.json

To silentize:

$ DEBUG=. boxcars config.json

It'll be outputting to stderr.



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;

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

To find out your personal limit:

$ ulimit -n

To change it:

$ ulimit -n 64000

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


  • Add -daemon option.

Something went wrong with that request. Please try again.