title: Elasticsearch error curl: (7) Failed to connect to localhost port 9200: Connection refused but localhost:9200 works on browser
body: <p>I'm trying to connect Elasticsearch 5.5.2 to a Django 2 project following this <a href="https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-elasticsearch-on-ubuntu-16-04" rel="nofollow noreferrer">tutorial</a> : </p>
  
  <p>When running : <code>curl -X GET 'http://localhost:9200'</code> on terminal, I got this error : <code>curl: (7) Failed to connect to localhost port 9200: Connection refused</code> while <code>localhost:9200</code> works very well on my browser.</p>
  
  <p>Here is an overview of my elasticsearch.yml file :</p>
  
  <pre><code># Use a descriptive name for your cluster:
  #
  #cluster.name: my-application
  #
  # Use a descriptive name for the node:
  #
  #node.name: node-1
  #
  # Add custom attributes to the node:
  #
  #node.attr.rack: r1
  #
  # Path to directory where to store the data (separate multiple locations by comma):
  #
  #path.data: /path/to/data
  #
  # Path to log files:
  #
  #path.logs: /path/to/logs
  #
  # Lock the memory on startup:
  #
  #bootstrap.memory_lock: true
  
  # Elasticsearch performs poorly when the system is swapping the memory.
  #
  # Set the bind address to a specific IP (IPv4 or IPv6):
  #
  network.host: 0.0.0.0
  #
  # Set a custom port for HTTP:
  #
  #http.port: 9200
  #
  # Pass an initial list of hosts to perform discovery when new node is started:
  # The default list of hosts is ["127.0.0.1", "[::1]"]
  #
  #discovery.zen.ping.unicast.hosts: ["host1", "host2"]
  #
  # Prevent the "split brain" by configuring the majority of nodes (total number of master-eligible nodes / 2 + 1):
  #
  #discovery.zen.minimum_master_nodes: 3
  #
  # For more information, consult the zen discovery module documentation.
  #
  # ---------------------------------- Gateway -----------------------------------
  #
  # Block initial recovery after a full cluster restart until N nodes are started:
  #
  #gateway.recover_after_nodes: 3
  #
  # For more information, consult the gateway module documentation.
  #
  # ---------------------------------- Various -----------------------------------
  #
  # Require explicit names when deleting indices:
  #
  #action.destructive_requires_name: true
  </code></pre>
  
  <p><code>/var/log/elasticsearch/</code> is empty.</p>
  
  <p>Please what's wrong with curl ?</p>