Setup NGINX Load Balancer with SSL on CentOS 6

Load balancing is a very common mechanism used to distribute traffic for systems. This tutorial goes through step by step from installation of NGINX on your CentOS web server and configuring your NGINX load balancer after it is installed successfully.

1. Add NGINX Repository

2. Install NGINX

3. Start NGINX

4. Configure NGINX config files

Locate NGINX configuration files at /etc/nginx/conf.d/ directory.

Ensure that you have SSL configured for your web server, if not you can follow the tutorial on Setting Up an SSL Secured Webserver with CentOS.

After you are done with the above steps, proceed to edit the following NGINX configuration file for SSL.

Editing NGINX config file

Add the following above your server {} module

Note that the servers will be served in round robin order. You can refer to NGINX documentation for more configurations.

The next few changes is to be done within the server {} module

Enable server to listen to port 443

Add server name

If you have followed my tutorial on Setting Up an SSL Secured Webserver with CentOS, then you can configure your SSL certificate and key as follows.

Next under location / {} module, add the following lines.

After which, save your NGINX configuration file.

Then restart NGINX.

That’s it you are done. If you have any other questions, do feel free to drop a comment below.

Leave a Reply

Your email address will not be published. Required fields are marked *

fifteen − seven =