0

I am trying to load balance frontend (public) and backend (private) servers in AWS. I got the nginx file working with a single server with IP address, but the loadbalancer DNS name doesn't seem to work, below is my nginx.conf for the frontend server. In the listener section of the loadbalancer the loadbalancer port is 443 and instance port is 9000. Any suggessions greatly appreciated.

WORKING...

    server {
        listen       80;
    rewrite ^(.*) https://example.com$request_uri;
}


server {
        listen       443;
    ssl    on;
    ssl_certificate    /etc/ssl/chain.crt;
    ssl_certificate_key    /etc/ssl/key.crt;
        listen       localhost:443;
    server_tokens off;
    client_max_body_size 300M;
        location / {
            root   /var/www/html;
            index  index.html index.htm;
        }
      location /api/ {
        proxy_set_header X-Real-IP $remote_addr;
        proxy_pass https://<BackendIP>:9000/api/;
        proxy_set_header Host $http_host;
        }  
}
}

NOT WORKING...

    server {
        listen       80;
    rewrite ^(.*) https://example.com$request_uri;
}


server {
        listen       443;
    ssl    on;
    ssl_certificate    /etc/ssl/chain.crt;
    ssl_certificate_key    /etc/ssl/key.crt;
        listen       localhost:443;
    server_tokens off;
    client_max_body_size 300M;
        location / {
            root   /var/www/html;
            index  index.html index.htm;
        }
      location /api/ {
        proxy_set_header X-Real-IP $remote_addr;
        proxy_pass https://<LOADBALANCER-DNS>:9000/api/;
        proxy_set_header Host $http_host;
        }  
}
}
Guru
  • 84
  • 5
  • Did you check your secure group of ELB? Make sure port 9000 is open. – David Lee Nov 02 '15 at 11:26
  • yes, security group has everything open b/w frontend and backend subnets. Can you think of something else in the nginx side mostly. – Guru Nov 04 '15 at 20:36

0 Answers0