Nginx-buildpack vendors NGINX inside a dyno and connects NGINX to an app server via UNIX domain sockets.
- Your webserver listens to the socket at
/tmp/nginx.socket
. - You touch
/tmp/app-initialized
when you are ready for traffic. - You can start your web server with a shell command.
Nginx-buildpack provides a command named bin/start-nginx
this command takes another command as an argument. You must pass your app server's startup command to start-nginx
.
For example, to get NGINX and Unicorn up and running:
$ cat Procfile
web: bin/start-nginx bundle exec unicorn -c config/unicorn.rb
You can configure NGINX's worker_processes
directive via the
NGINX_WORKERS
environment variable.
For example, to set your NGINX_WORKERS
to 8 on a PX dyno:
$ heroku config:set NGINX_WORKERS=8
You can provide your own NGINX config by creating a file named nginx.conf.erb
in the config directory of your app. Start by copying the buildpack's default config file.