Deploying static sites
To set up a “hello world” demo or a more complex static site, see the Cloud Foundry Staticfile buildpack documentation. It includes “hello world” instructions and a full list of configuration options, including how to set up basic authentication and configure nginx (the underlying web server).
If you are using a static site generator (e.g. Jekyll or Hugo) and/or it requires dependencies to be installed at deploy-time, you should set up continuous deployment. This way, the build happens in your Continuous Integration (CI) system rather than during the deploy itself within Cloud Foundry. This helps to make your deployments more reliable, have a smaller footprint, and reduce downtime.
Deploying a Jekyll site requires a few things:
Add or update your
Gemfileto include the
source 'https://rubygems.org' gem 'jekyll'
Staticfilepointing to the root of the built site, as specified in the Cloud Foundry Staticfile buildpack documentation.
See 18F/notalone for an example.
Redirect all traffic
If a site moves to a different domain name, you can use cf-redirect to redirect all traffic from the old domain to the new domain.
You can read more about nginx customization at the Staticfile Buildpack documentation.