title: How to configure AWS ELB in a replace of NGiNX server & it's settings?
body: <p>I would like to know, how can we completely migrate from <code>NGiNX</code> to <code>AWS ELB</code> including <code>SSL</code>(AWS certificate) ?</p>
  
  <p>I have following <code>NGiNX</code> configuration for one of my domain(for example, <code>example.com</code>)</p>
  
  <pre><code>server {
      listen 80;
      server_name *.example.com;
      root /home/ubuntu/angularApp;
      index    index.html index.htm;
  
      location / {
        try_files $uri $uri/ /index.html;
      }
  
  }
  
  
  server {
    listen 80;
    server_name example.com;
  
    root /home/ubuntu/website;
    index    index.html index.htm;
  
    location / {
      try_files $uri $uri/ /index.html;
    }
  
    location ~ ^/api/(v1|v2)/ {
      proxy_pass http://backend_service$request_uri;
      proxy_redirect off;
      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-Host $server_name;
      proxy_set_header X-Google-Real-IP $remote_addr;
  
    }
  
  }
  </code></pre>
  
  <p>I have mainly 2-query,</p>
  
  <p><strong>Query#1 :-</strong>
  How to configure a setting(in <code>ELB</code>) for <code>Angular-App pages</code> if requested URL contains/belongs <code>subdomain</code> otherwise refer other directory's index.html file instead of Angular-App.</p>
  
  <p><strong>Query#2 :-</strong>
  How to configure a setting(in <code>ELB</code>) to point API which is running on someother port on the same server(<code>EC2</code>) if incoming request's <code>URI</code> contain <code>/api/v1/</code> or <code>/api/v2/</code></p>
  
  <blockquote>
    <p>NOTE - I have already approved AWS SSL Certificate which we can
    configure in ELB. so regarding SSL Certificate there won't be any
    issue. Currently I am using other than AWS's SSL certificate which is configured into NGiNX but have planned to use AWS ACM since all other things belongs to within AWS.</p>
  </blockquote>
  
  <p><em>Any help would be really appreciable !!</em> </p>