HTTP directives

listen directive (HTTP)

Binds an HTTP virtual server to a specified listening address and port. This entry covers the basic TCP form, not every protocol or socket option. Context: server. Use an explicit loopback address for a local lab. Example is a partial configuration for the supplied isolated lab; do not paste it into a running host configuration.

Formal Syntax & Structure

nginx syntaxnginx
listen address:port;

Parameters & Attributes

NameTypeDescription
address:portstringAddress and port to accept connections on.

Working Example

Example Snippetnginx
server {    listen 127.0.0.1:18080;    root html;}
Nginx Reference