Method: Puma::DSL#bind

Defined in:

#bind(url) ⇒ Object

Bind the server to url. “tcp://”, “unix://” and “ssl://” are the only accepted protocols. Multiple urls can be bound to, calling bind does not overwrite previous bindings.

The default is “tcp://”.

You can use query parameters within the url to specify options:

  • Set the socket backlog depth with backlog, default is 1024.

  • Set up an SSL certificate with key & cert.

  • Set up an SSL certificate for mTLS with key, cert, ca and verify_mode.

  • Set whether to optimize for low latency instead of throughput with low_latency, default is to not optimize for low latency. This is done via Socket::TCP_NODELAY.

  • Set socket permissions with umask.


Backlog depth

bind 'unix:///var/run/puma.sock?backlog=512'

SSL cert

bind 'ssl://'

SSL cert for mutual TLS (mTLS)

bind 'ssl://'

Disable optimization for low latency

bind 'tcp://'

Socket permissions

bind 'unix:///var/run/puma.sock?umask=0111'

See Also:

# File 'lib/puma/dsl.rb', line 274

def bind(url)
  @options[:binds] ||= []
  @options[:binds] << url