Deploying static sites
To get a full list of configuration options, including how to configure nginx, see the Cloud Foundry Staticfile buildpack documentation.
$ touch index.html
Add some markup:
<html> <head> <title>Static Site</title> </head> <body> <p>Welcome to the static site!</p> </body> </html>
manifest.yml that uses the
--- applications: - name: my-static-site memory: 64M buildpack: https://github.com/cloudfoundry/staticfile-buildpack.git env: FORCE_HTTPS: true
If the static content is included in a different folder, you can add a
path declaration. E.g.,
path: dist or
$ cf push
If you are using a static site generator (e.g. Jekyll or Hugo) and/or it requires dependencies to be installed at deploy-time, it’s especially recommended that you 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 above. The static buildpack will interpret with file.
manifest.ymlto use the static buildpack.
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.