scgi_bind

The `scgi_bind` directive specifies the address and port on which the SCGI server will listen for connections.

Syntaxscgi_bind address [port];
Defaultnone
Contexthttp, server, location
Arguments1-2

Description

The scgi_bind directive defines the network address and port that NGINX will use to communicate with an SCGI application server. This directive is crucial for configuring how incoming SCGI requests are routed to the appropriate backend server. It can accept either an IP address or a Unix socket path, allowing flexibility in server topology.

It is important to understand that this directive can be specified in http, server, or location contexts, and it can take one or two arguments. The first argument is mandatory and represents the address to bind to, while the optional second argument specifies a port number. If only one argument is provided and it is a Unix socket, no port number is necessary. Additionally, specifying a port number explicitly can be important for TCP/IP communications to ensure the SCGI server is reachable at the right endpoint.

When using scgi_bind, make sure the address is not already in use and that proper permissions are set for Unix socket files, as these files enforce filesystem permissions. Misconfigurations can lead to connection failures or inaccessible services.

Config Example

server {
    listen 80;
    location / {
        scgi_pass 127.0.0.1:4000;
        scgi_bind 127.0.0.1 4000;
    }
}

Ensure that the port specified is not already in use by another service.

When using Unix sockets, ensure the socket file has the correct permissions set for the user running NGINX.

← Back to all directives