Skip to main content

Static Sites

If you have a site with purely static content, Deploio makes use of a combination of buildpacks to deploy a web server to serve your static files.

note

If you use the heroku buildpack stack with nctl, you must explicitly set --language=static when creating or updating your application, as automatic static site detection is only available on the paketo stack.

Static sites are detected by looking for these files in your git repo:

  • index.html
  • public/index.html

Example Apps

We have two static sites in our examples repository. You can deploy them with nctl:

Plain index.html:

nctl create application static-html \
--language=static \
--git-url=https://github.com/ninech/deploio-examples \
--git-sub-path=heroku-stack/static/html

React app with npm:

nctl create application static-react \
--language=static \
--git-url=https://github.com/ninech/deploio-examples \
--git-sub-path=heroku-stack/static/react

Paketo Stack Configuration

To override the automatically detected paths mentioned above, you can specify the build env variable BP_STATIC_WEBROOT=<directory> to any directory within your Git repository.

Heroku Stack Configuration

When using the heroku buildpack stack, the web server is configured via a project.toml file in the root of your repository instead of build environment variables. The default document root is the public directory.

To change the document root or index file, add the following to your project.toml:

[com.heroku.static-web-server]
root = "dist"
index = "index.html"

The buildpack supports additional options such as custom response headers, error pages, redirects, and clean URLs — all configured through project.toml. See the Heroku Static Web Server buildpack documentation for the full reference.

NPM Frontend

If you have Node modules that need to be installed during the build step, Deploio will detect this using the package.json file and run npm . In this case, the resulting files will end up in the directory build and it will serve the artifacts from there.