title: NGINX configuration resolver not working for local host
body: <p>I have deployed my project(angular) on nginx its running  on port 4210. I am using AWS ec2 instance. when I am trying to run my project on browser its giving me 500 internal server error.Can you please tell me where I am going wrong this is my first time.Thank You in advance</p>
  <p><code>nginx -t</code> is giving success and angular server is also working</p>
  <p><strong>Default server configuration(sites-available)</strong></p>
  <pre><code>server {
          listen 80;
          listen [::]:80;
          listen 127.0.0.1;
          proxy_connect_timeout       600s;
          proxy_send_timeout          600s;
          proxy_read_timeout          600s;
          send_timeout                600s;
          set $frontend &quot;http://localhost:4210&quot;;
          set $apiBackend &quot;http://localhost:5002&quot;;
  
          root /var/www/html;
  
          # Add index.php to the list if you are using PHP
          index index.html index.htm index.nginx-debian.html;
  
          server_name _;
  
          location / {
  
                  proxy_set_header X-Real-IP $remote_addr;
                  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                  proxy_set_header Host $http_host;
                  proxy_set_header X-NginX-Proxy true;
                  proxy_pass $frontend/$uri$is_args$args;
                  proxy_redirect off;
          }
  
          location /api {
  
                  proxy_set_header X-Real-IP $remote_addr;
                  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                  proxy_set_header Host $http_host;
                  proxy_set_header X-NginX-Proxy true;
                  proxy_pass $apiBackend/$uri$is_args$args;
                  proxy_redirect off;
          }
  
     }
  </code></pre>
  <p><strong>my nginx.conf file</strong></p>
  <pre><code>  user www-data;
       worker_processes auto;
       pid /run/nginx.pid;
       include /etc/nginx/modules-enabled/*.conf;
  
       events {
           worker_connections 768;
           # multi_accept on;
       }
  
       http {
          ##
          # Basic Settings
          ##enter code here
  
          sendfile on;
          tcp_nopush on;
          tcp_nodelay on;
          keepalive_timeout 65;
          types_hash_max_size 2048;
          # server_tokens off;
          resolver 127.0.0.1;
          
          include /etc/nginx/mime.types;
          default_type application/octet-stream;
  
          ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
          ssl_prefer_server_ciphers on;
  
          access_log /var/log/nginx/access.log;
          error_log /var/log/nginx/error.log;
  
          ##
          # Gzip Settings
          ##
  
          gzip on;
  
          include /etc/nginx/conf.d/*.conf;
          include /etc/nginx/sites-enabled/*;
       }
  </code></pre>
  <p>logs</p>
  <blockquote>
  <p>2019/09/05 18:47:47 [error] 7090#7090: send() failed (111: Connection refused) while resolving, resolver: 127.0.0.1:53</p>
  </blockquote>
  <blockquote>
  <p>2019/09/05 18:47:47 [error] 7090#7090: send() failed (111: Connection refused) while resolving, resolver: 127.0.0.1:53</p>
  </blockquote>