NGINX Buildpack

Page last updated:


This topic describes how to configure your NGINX application for use with the NGINX buildpack and how to push your NGINX app to Cloud Foundry.


We recommend using the default NGINX directory structure for your NGINX webserver.

The NGINX webserver setup includes:

  • A root folder for all static web content
  • A mime type configuration file
  • A NGINX configuration file
  • A yaml file that defines what version of NGINX you want to use

Any custom configuration changes should be made from these default files to ensure compatability with the buildpack.

Dynamic Modules

Buildpack-Provided Modules

For nginx-buildpack v0.0.5 and later, the following dynamic modules will be built in and loadable by NGINX’s load_module directive.

  • Stream module:

To use a built-in dynamic module, use the load_module {{.NginxModulesDir}}/<module file name>; syntax at the top of your nginx.conf.

For example, to use the stream module:

  load_module {{.NginxModulesDir}}/;

User-Provided Modules

Users can supply their own dynamic modules by placing them in the application directory and supplying a path to the module in the nginx.conf file. To configure a user-provided dynamic module, use the following syntax:

  load_module <path to module>;

For example, to use a module called inside a modules directory:

  load_module modules/;

Push Your App

Follow the steps below to push your application.

Step Action
1. Use the cf push APP_NAME command to push your app. Replace APP_NAME with the name you want to give your application. For example:
$ cf push my-app
Creating app my-app in org sample-org / space sample-space as
requested state: started
instances: 1/1
usage: 1GB x 1 instances
If you do not have the buildpack, or the installed version is out-of-date, use the -b option to specify the buildpack as follows:
cf push APP_NAME -b
2. Find the URL of your app in the output from the push command and navigate to it to see your NGINX app running.

Buildpack Support

A number of channels exist where you can get more help when using the NGINX buildpack, or with developing your own NGINX buildpack.

  • NGINX Buildpack Repository in Github: Find more information about using and extending the NGINX buildpack in GitHub repository.

  • Release Notes: Find current information about this buildpack on the NGINX buildpack release page in GitHub.

  • Slack: Join the #buildpacks channel in the Cloud Foundry Slack community.

Create a pull request or raise an issue on the source for this page in GitHub