Static Sites
Railpack can automatically build and setup a server for static sites that require no build steps. The Caddy server is used as the underlying web server.
Detection
Your project will be automatically detected as a static site if any of these conditions are met:
- A
Staticfile
configuration file exists in the root directory - An
index.html
file exists in the root directory - A
public
directory exists - The
RAILPACK_STATIC_FILE_ROOT
environment variable is set
Root Directory Resolution
The provider determines the root directory in this order:
RAILPACK_STATIC_FILE_ROOT
environment variable if setroot
directory specified inStaticfile
if presentpublic
directory if it exists- Current directory (
.
) ifindex.html
exists in root
Configuration
Staticfile
You can configure the root directory with a Staticfile
that contains the contents:
# root directory to serveroot: dist
Config Variables
Variable | Description | Example |
---|---|---|
RAILPACK_STATIC_FILE_ROOT | Override the root directory | public |
Custom Caddyfile
Railpack uses a custom Caddyfile that is used to serve the static files. You can overwrite this file with your own Caddyfile at the root of your project.