NGINX Configuration Tips: Difference between revisions

No edit summary
Line 16: Line 16:


'''NOTE''': Only add servers running the mailbox service to the route lookup handler list. This is because the URL used by NGINX is of the form <nowiki>http://<server>:7072/service/extension/nginx-lookup</nowiki> - and this URL is handled by jetty.
'''NOTE''': Only add servers running the mailbox service to the route lookup handler list. This is because the URL used by NGINX is of the form <nowiki>http://<server>:7072/service/extension/nginx-lookup</nowiki> - and this URL is handled by jetty.
== Set up Virtual Hosting (Domain Completion) for Mail ==
For accounts authenticating without domain, NGINX internally suffixes @domain to the login name, by first looking up an existing domain by the IP address of the proxy interface where the connection came in. If no such domain is found, then NGINX falls back to the default domain name specified by the config attribute '''zimbraDefaultDomainName'''.
The IP to domain mapping is done based on the '''zimbraVirtualIPAddress''' attribute of the domain.
If you want to set up virtualhosting for multiple domains, then follow these steps:
* For each domain, identify a set of proxy IP addresses that should be reverse mapped to this domain. Then, for each of these IP addresses, execute the command
: zmprov md <domain> +zimbraVirtualIPAddress 1.2.3.4
: zmprov md <domain> +zimbraVirtualIPAddress 5.6.7.8
* The above step will ensure that if a mail user logs in on Proxy IP 1.2.3.4, or on IP address 5.6.7.8, then @<domain> will automatically be suffixed to the login name
'''NOTE''' The IP-to-domain mapping is a many-to-one relationship. That means, one domain can map to multiple IP addresses, but one IP address can only map to a single domain. Therefore, to set up domain completion for multiple domains, at least one separate IP address must be allocated for each domain, and the NGINX Proxy must accept connections on these IP addresses.

Revision as of 10:59, 10 September 2008

Many configuration parameters of NGINX can be customized. This page provides tips to take care of the most usual ways to customize NGINX configuration.

View/Modify Route Lookup Handlers (garpu)

The command zmprov garpu (get all reverse proxy urls) gives a list of all the route lookup handlers used by NGINX for mail/web route discovery.

zmprov garpu will list all the servers for which zimbraReverseProxyLookupTarget is TRUE.

Therefore, to add a server to the route lookup handler list, execute the command:

zmprov ms <server> zimbraReverseProxyLookupTarget TRUE

To remove a server from the route lookup handler list, execute the command:

zmprov ms <server> zimbraReverseProxyLookupTarget FALSE

NOTE: Only add servers running the mailbox service to the route lookup handler list. This is because the URL used by NGINX is of the form http://<server>:7072/service/extension/nginx-lookup - and this URL is handled by jetty.

Set up Virtual Hosting (Domain Completion) for Mail

For accounts authenticating without domain, NGINX internally suffixes @domain to the login name, by first looking up an existing domain by the IP address of the proxy interface where the connection came in. If no such domain is found, then NGINX falls back to the default domain name specified by the config attribute zimbraDefaultDomainName.

The IP to domain mapping is done based on the zimbraVirtualIPAddress attribute of the domain.

If you want to set up virtualhosting for multiple domains, then follow these steps:

  • For each domain, identify a set of proxy IP addresses that should be reverse mapped to this domain. Then, for each of these IP addresses, execute the command
zmprov md <domain> +zimbraVirtualIPAddress 1.2.3.4
zmprov md <domain> +zimbraVirtualIPAddress 5.6.7.8
  • The above step will ensure that if a mail user logs in on Proxy IP 1.2.3.4, or on IP address 5.6.7.8, then @<domain> will automatically be suffixed to the login name

NOTE The IP-to-domain mapping is a many-to-one relationship. That means, one domain can map to multiple IP addresses, but one IP address can only map to a single domain. Therefore, to set up domain completion for multiple domains, at least one separate IP address must be allocated for each domain, and the NGINX Proxy must accept connections on these IP addresses.

Jump to: navigation, search