=encoding utf-8 =head1 NAME ngx_mail_core_module - Module ngx_mail_core_module =head1 This module is not built by default, it should be enabled with the C<--with-mail> configuration parameter. =head1 Example Configuration worker_processes 1; error_log /var/log/nginx/error.log info; events { worker_connections 1024; } mail { server_name mail.example.com; auth_http localhost:9000/cgi-bin/nginxauth.cgi; imap_capabilities IMAP4rev1 UIDPLUS IDLE LITERAL+ QUOTA; pop3_auth plain apop cram-md5; pop3_capabilities LAST TOP USER PIPELINING UIDL; smtp_auth login plain cram-md5; smtp_capabilities "SIZE 10485760" ENHANCEDSTATUSCODES 8BITMIME DSN; xclient off; server { listen 25; protocol smtp; } server { listen 110; protocol pop3; proxy_pass_error_message on; } server { listen 143; protocol imap; } server { listen 587; protocol smtp; } } =head1 Directives =head2 listen B listen I< I>:I> [C] [C=I>] [C] [C=CEC] [C=CECE[I>]:[I>]:[I>]]> B I Sets the I> and I> for the socket on which the server will accept requests. It is possible to specify just the port. The address can also be a hostname, for example: listen 127.0.0.1:110; listen *:110; listen 110; # same as *:110 listen localhost:110; IPv6 addresses (0.7.58) are specified in square brackets: listen [::1]:110; listen [::]:110; UNIX-domain sockets (1.3.5) are specified with the “C” prefix: listen unix:/var/run/nginx.sock; Different servers must listen on different I>:I> pairs. The C parameter allows specifying that all connections accepted on this port should work in SSL mode. The C directive can have several additional parameters specific to socket-related system calls. =over =item C=I> sets the C parameter in the C call that limits the maximum length for the queue of pending connections (1.9.2). By default, C is set to -1 on FreeBSD, DragonFly BSD, and Mac OS X, and to 511 on other platforms. =item C this parameter instructs to make a separate C call for a given address:port pair. The fact is that if there are several C directives with the same port but different addresses, and one of the C directives listens on all addresses for the given port (C<*:>I>), nginx will C only to C<*:>I>. It should be noted that the C system call will be made in this case to determine the address that accepted the connection. If the C or C parameters are used then for a given I>:I> pair a separate C call will always be made. =item C=CEC this parameter determines (via the C socket option) whether an IPv6 socket listening on a wildcard address C<[::]> will accept only IPv6 connections or both IPv6 and IPv4 connections. This parameter is turned on by default. It can only be set once on start. =item C=CECE[I>]:[I>]:[I>] this parameter configures the “TCP keepalive” behavior for the listening socket. If this parameter is omitted then the operating system’s settings will be in effect for the socket. If it is set to the value “C”, the C option is turned on for the socket. If it is set to the value “C”, the C option is turned off for the socket. Some operating systems support setting of TCP keepalive parameters on a per-socket basis using the C, C, and C socket options. On such systems (currently, Linux 2.4+, NetBSD 5+, and FreeBSD 9.0-STABLE), they can be configured using the I>, I>, and I> parameters. One or two parameters may be omitted, in which case the system default setting for the corresponding socket option will be in effect. For example, so_keepalive=30m::10 will set the idle timeout (C) to 30 minutes, leave the probe interval (C) at its system default, and set the probes count (C) to 10 probes. =back =head2 mail mail { B<...> } B I
Provides the configuration file context in which the mail server directives are specified. =head2 protocol B protocol I< C E C E C> B I Sets the protocol for a proxied server. Supported protocols are L, L, and L. If the directive is not set, the protocol can be detected automatically based on the well-known port specified in the L directive: =over =item * C: 143, 993 =item * C: 110, 995 =item * C: 25, 587, 465 =back Unnecessary protocols can be disabled using the L parameters C<--without-mail_imap_module>, C<--without-mail_pop3_module>, and C<--without-mail_smtp_module>. =head2 resolver B resolver I< I> ... [C=I>]> B resolver I> B I B I B I Configures name servers used to find the client’s hostname to pass it to the L, and in the L command when proxying SMTP. For example: resolver 127.0.0.1 [::1]:5353; An address can be specified as a domain name or IP address, and an optional port (1.3.1, 1.2.2). If port is not specified, the port 53 is used. Name servers are queried in a round-robin fashion. B Before version 1.1.7, only a single name server could be configured. Specifying name servers using IPv6 addresses is supported starting from versions 1.3.1 and 1.2.2. By default, nginx caches answers using the TTL value of a response. An optional C parameter allows overriding it: resolver 127.0.0.1 [::1]:5353 valid=30s; B Before version 1.1.9, tuning of caching time was not possible, and nginx always cached answers for the duration of 5 minutes. The special value C disables resolving. =head2 resolver_timeout B resolver_timeout I>> B I<30s> B I B I Sets a timeout for DNS operations, for example: resolver_timeout 5s; =head2 server server { B<...> } B I Sets the configuration for a server. =head2 server_name B server_name I>> B I B I B I Sets the server name that is used: =over =item * in the initial POP3ESMTP server greeting; =item * in the salt during the SASL CRAM-MD5 authentication; =item * in the C command when connecting to the SMTP backend, if the passing of the L command is enabled. =back If the directive is not specified, the machine’s hostname is used. =head2 timeout B timeout I>> B I<60s> B I B I Sets the timeout that is used before proxying to the backend starts.