title: conflicting server name "localhost" warning on nginx
body: <p>I am trying to set up nginx for my localhost on a linux cntainer
  Here is the config </p>
  
  <pre><code>## server configuration
  server {
      listen 443 ssl;
      listen 80 ;
      ## add ssl entries when https has been set in config
      ssl_certificate      /etc/ssl/cert.pem;
      ssl_certificate_key  /etc/ssl/key.pem;
      ssl_session_cache shared:SSL:1m;
      ssl_prefer_server_ciphers   on;
  
      server_name localhost;
      if ($http_x_forwarded_proto = '') {
          set $http_x_forwarded_proto  $scheme;
      }
      ## Application specific logs
      ## access_log /var/log/nginx/localhost-access.log timing;
      ## error_log /var/log/nginx/localhost-error.log;
      rewrite ^/$ /artifactory/webapp/ redirect;
      rewrite ^/artifactory/?(/webapp)?$ /artifactory/webapp/ redirect;
      location /artifactory/ {
      proxy_read_timeout  900;
      proxy_pass_header   Server;
      proxy_cookie_path ~*^/.* /;
      proxy_pass         http://localhost:8081/artifactory/;
      proxy_set_header   X-Artifactory-Override-Base-Url $http_x_forwarded_proto://$host:$server_port/artifactory;
      proxy_set_header    X-Forwarded-Port  $server_port;
      proxy_set_header    X-Forwarded-Proto $http_x_forwarded_proto;
      proxy_set_header    Host              $http_host;
      proxy_set_header    X-Forwarded-For   $proxy_add_x_forwarded_for;
      }
  }
  
  ## server configuration
  server {
      listen 6555 ssl;
  
  
      server_name localhost;
      if ($http_x_forwarded_proto = '') {
          set $http_x_forwarded_proto  $scheme;
      }
      ## Application specific logs
      ## access_log /var/log/nginx/localhost-access.log timing;
      ## error_log /var/log/nginx/localhost-error.log;
      rewrite ^/(v1|v2)/(.*) /artifactory/api/docker/docker-virtual/$1/$2;
      client_max_body_size 0;
      chunked_transfer_encoding on;
      location /artifactory/ {
      proxy_read_timeout  900;
      proxy_pass_header   Server;
      proxy_cookie_path ~*^/.* /;
      proxy_pass         http://localhost:8081/artifactory/;
      proxy_set_header   X-Artifactory-Override-Base-Url $http_x_forwarded_proto://$host:$server_port/artifactory;
      proxy_set_header    X-Forwarded-Port  $server_port;
      proxy_set_header    X-Forwarded-Proto $http_x_forwarded_proto;
      proxy_set_header    Host              $http_host;
      proxy_set_header    X-Forwarded-For   $proxy_add_x_forwarded_for;
      }
  }
  </code></pre>
  
  <p>After I retsrat nginx I get the following error</p>
  
  <pre><code>nginx: [warn]nginx: [warn] conflicting server name "localhost" on 0.0.0.0:80, ignored
  </code></pre>
  
  <p>"localhost" on 0.0.0.0:80, ignored</p>
  
  <p>Also when I navigate to the browser I get a connection refused on localhost:443</p>
  
  <p>What might be wrong?</p>