Here is How To Setup Nginx Load Balancing SSL Termination on HP Cloud Running Ubuntu Latest Version. Supported by both Nginx Free Ed. & Plus. For HP Horizon Cloud, we need some special extra steps for the first time as there is router. The commands, definitely will remain the same for any cloud service provider.
Prerequisites of Nginx Load Balancing SSL Termination
We are taking it granted that, the reader has configured router and security group properly. Two other servers, which will act as backend are working fine.
Nginx, both community version and the paid Nginx Plus can be configured as a load balancer to distribute load to the backend servers. As SSL termination occurs on the load balancer so SSL/TLS configuration must be done on the server instance we are talking about. We will not discuss about this part in this guide.
---
Nginx Load Balancing SSL Termination (HP Cloud+Ubuntu)
Normally we will proceed to install Nginx :
1 2 | apt-get update -y && apt-get upgrade apt get install nginx-full |
We do not need to install PHP5/ PHP5-FPM on this instance as the request will be conveyed to the backend servers. Now take that, the subnet mask of the web servers are 10.0.0.10
and 10.0.0.11
, on nginx.conf
file we should have :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | http { upstream web_rack { server 10.0.0.10:80; server 10.0.0.11:80; # underscores_in_headers on; } server { listen 80; server_name thecustomizewindows.com; location / { proxy_pass http://web_servers; } } } |
next, the host file should have the /etc/nginx/sites-available/default
file like this :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | server { listen 80; listen 443 ssl spdy default; server_name thecustomizewindows.com; ssl on; .... SSL Specific Settings .... location / { proxy_pass http://web_servers; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; } } |
For one website setup, frankly we can do the works only on /etc/nginx/sites-available/default
file. As Nginx Plus uses the nginx.conf
, we have shown this kind of setup.
Now run :
1 2 | service nginx -t service nginx restart |