To use Nginx load balancer to route traffic to multiple hosts, follow this procedure to set it up for use with Arc:
- Install Nginx. See http://nginx.org/en/download.html for instructions.
- Install the Nginx Controller on the load balancer host, as described below.
- On the load balancer host, either:
- Run the Nginx Controller for testing and initial setup.
- Install the Nginx Controller as an operating system service for production use (supported only on certain Linux distributions--see sl-nginx-ctl-install for details).
- Add the load balancer in Arc Manager. See Managing multi-server apps.
Installing the StrongLoop Nginx Controller
The StrongLoop Nginx Controller enables you to configure Nginx remotely using Arc. Install it on a load balancer host as follows:
- Use sl-nginx-ctl to run the Nginx Controller as a transient process for development and testing (not recommended for production).
- Use sl-nginx-ctl-install to install the Nginx Controller as an operating system service.
NOTE: This command is supported only on Linux distributions that support Upstart or systemd (such as RedHat, Debian, and Ubuntu). See sl-nginx-ctl-install for details.
Running as a transient process
sl-nginx-ctl command to run the StrongLoop Nginx Controller. See the sl-nginx-ctl command reference for details.
For example, if Nginx is installed in the default location,
/usr/sbin/nginx, you can run the controller as a transient process (for development) as follows:
This runs the Nginx Controller with all the default options:
- Base working directory
- Control API endpoint URL
- Listen endpoint URL for incoming HTTP traffic is
Installing as a service
sl-nginx-ctl-install command to install the StrongLoop Nginx Controller as an operating system service. See the sl-nginx-ctl-install command reference for details.
By default, the command installs the service as an Upstart (version 1.4) job and runs the Controller with user account strong-nginx-controller.
This runs the command with the defaults:
- Base directory working directory
- Control API endpoint
- Listens for incoming HTTP traffic at
- Path of Upstart job is
- Path to Nginx binary