Paketo Buildpacks | Blog

Introducing the Paketo Web Servers Buildpack

Joshua Casey
Wednesday, May 18, 2022

The Paketo team is pleased to introduce the Web Servers buildpack, available in the Paketo Full Builder as of version 0.2.74.

This buildpack allows you to serve static content using the popular NGINX or HTTPD web servers, with a variety of utilities for ease of use. Whether you have static files and a server configuration file that you want to package in an image, or you need to transform your dynamic content into static files and want the buildpack to generate the necessary server configuration file, the Web Servers buildpack has you covered.

If the buildpack does not have the capability you need, please let us know on the Paketo Slack or by filing an issue.

While Paketo has had the NGINX and HTTPD buildpacks for some time, bringing them together in the new Web Servers buildpack enables the exciting capabilities listed below.

Using npm and yarn to generate static content

You can now easily deploy your dynamic frontend application as static content, since the Web Servers buildpack allows you to execute arbitrary npm or yarn scripts by using the node-run-script buildpack. Just add appropriate scripts in package.json and set the BP_NODE_RUN_SCRIPTS environment variable at build-time to tell the buildpack which scripts to run.

This allows you to create your frontend application in the JavaScript framework of your choice and then serve it up using either HTTPD or NGINX. Since npm and yarn can be used in the absence of a JavaScript framework, you can also use this capability to download dependencies, transpile JavaScript, assemble content, or do anything necessary to translate your source material into static files.

Zero-Config static sites

What if your app is simple enough that you don’t need a custom httpd.conf or nginx.conf? Set the BP_WEB_SERVER environment variable at build-time to both indicate your server preference and signal to the appropriate buildpack to generate a server configuration file.

You can use environment variables and service bindings to tweak the automatically-generated configuration file so that you can:

  • Use a custom directory for static files
  • Enable push-state routing
  • Force HTTPS connections
  • Require basic auth

See How to Build Web Servers with Paketo Buildpacks for configuration details. The No Config File Sample also has working examples of each of these configurations.

These customizations are meant to work out of the box for both HTTPD and NGINX. In case you need more details, take a look at the default configuration files (see HTTPD and NGINX).

Additional utilities

In addition to the new application types described above, utility buildpacks added to the toolchain allow enhancing the images built to serve your static files. This enables you to:

  • Add CA certificates to the system truststore at build and runtime using the ca-certificates buildpack
  • Set custom start commands using the procfile buildpack
  • Embed environment variables into the launch image using the environment-variables buildpack
  • Add image labels to the launch image using the image-labels buildpack
  • Run any arbitrary script in package.json using the node-run-script buildpack, which enables you to transform your frontend application into static files (among many other possibilities)


The Paketo samples have several different application types that can be built into OCI images using Paketo buildpacks. These demonstrate common use cases such as:

  • Serving static content with your own server configuration file, using either HTTPD or NGINX
  • Serving static content with a buildpack-generated server configuration file, using BP_WEB_SERVER to select either HTTPD or NGINX
  • Using NPM to build a React app into static files that can be served by a web server, using BP_WEB_SERVER to select either HTTPD or NGINX

Additional Reading