Deploy static websites on your servers using OpsCaptain

OpsCaptain supports static website hosting powered by Nginx using the Cloud Foundry staticfile-buildpack. From the developers perspective, you simply deploy your files using the CLI and OpsCaptain configures the environment to install Nginx and run your static website in a Docker container. If you are interested in understanding how the buildpack works and also how to configure parameters such as Basic Authentication, Directory listing, enabling GZip etc, you can review the buildpack documentation link.


Install the opscaptain-cli on your local machine and also log in. If you haven't, run the below commands from your terminal to install it and login:

npm install -g opscaptain-cli opscaptain login -em -pw ******

You must have already added the server that will be used to host your static website. To add a server to your OpsCaptain account, follow this guide here.

If you do not have a server yet, you can purchase a server or use the free tier or credit from one of the following clouds: AWS EC2, Microsoft Azure, Vultr, DigitalOcean and Google

Step 1. Create your static website

From the dashboard: Log into the dashboard and create a new static website using this link. You do not have to make a selection under the Database engine field since this is a static website. Once the website is created, you can then proceed to deploy your assets to it.

Step 2. Create the ocmanifest.json file in your application directory.

You will typically configure the ocmanifest.json file on your first deployment or when you need to change any environment variables.

The below example shows a sample ocmanifest.json file to deploy static websites:

{ // The name you provided when creating the app in step 1 name: "my-blog", buildpacks: ["static"] }

Step 3. Deploy your static website

CD into the project directory. Once there, run the below command to deploy and that's it.

opscaptain deploy