# "error": "Bad Gateway"

**URL:** <https://discuss.elastic.co/t/error-bad-gateway/102413>\
**Category:** Elasticsearch\
**Created:** [October 2, 2017, 8:33am UTC](https://discuss.elastic.co/t/error-bad-gateway/102413 "2017-10-02T08:33:01Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![hack3rcon](https://avatars.discourse-cdn.com/v4/letter/h/96bed5/32.png) [@hack3rcon](https://discuss.elastic.co/u/hack3rcon)\
**Post date:** [October 2, 2017, 8:33am UTC](https://discuss.elastic.co/t/error-bad-gateway/102413/1 "2017-10-02T08:33:01Z")

</div>

Hello.  
I have a problem about backup and restore logs. My Elasticsearch config is as below:

```auto
# ----------------------------------- Paths ------------------------------------
# 
# Path to directory where to store the data (separate multiple locations by comma):
#
#path.data: /path/to/data
path.repo: ["/var/log/back-long/repo"]
#
# Path to log files:
#
path.logs: /var/log/elastic
#
```

and

```auto
# ls -l
drwxr-xr-x. 3 elastic elastic 17 Oct 2 12:30 back-long
```

When I write below code in "Dev Tools":

```auto
PUT /_snapshot/my_backup
{
  "type": "fs",
  "settings": {
        "compress": true,
		"location": "/var/log/back-long/repo"
  }
}
```

Then:

```auto
{
  "statusCode": 502,
  "error": "Bad Gateway",
  "message": "connect ECONNREFUSED 127.0.0.1:9200"
}
```

Why? Any idea?

Thank you.

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [October 2, 2017, 8:48am UTC](https://discuss.elastic.co/t/error-bad-gateway/102413/2 "2017-10-02T08:48:08Z")

</div>

What gives:

```auto
GET /

```

?

Anything in elasticsearch logs?

---

<div class="post-metadata">

**Author:** ![hack3rcon](https://avatars.discourse-cdn.com/v4/letter/h/96bed5/32.png) [@hack3rcon](https://discuss.elastic.co/u/hack3rcon)\
**Post date:** [October 3, 2017, 2:03pm UTC](https://discuss.elastic.co/t/error-bad-gateway/102413/3 "2017-10-03T14:03:24Z")

</div>

the result is:

```auto
{
  "name": "Cbg6tCU",
  "cluster_name": "elasticsearch",
  "cluster_uuid": "gQk4b-FSQ2-W-dmqcRaaOA",
  "version": {
    "number": "5.4.1",
    "build_hash": "2cfe0df",
    "build_date": "2017-05-29T16:05:51.443Z",
    "build_snapshot": false,
    "lucene_version": "6.5.1"
  },
  "tagline": "You Know, for Search"
}
```

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [October 3, 2017, 2:17pm UTC](https://discuss.elastic.co/t/error-bad-gateway/102413/4 "2017-10-03T14:17:00Z")

</div>

> Anything in elasticsearch logs?

Can you share your elasticsearch logs please?

---

<div class="post-metadata">

**Author:** ![hack3rcon](https://avatars.discourse-cdn.com/v4/letter/h/96bed5/32.png) [@hack3rcon](https://discuss.elastic.co/u/hack3rcon)\
**Post date:** [October 3, 2017, 2:38pm UTC](https://discuss.elastic.co/t/error-bad-gateway/102413/5 "2017-10-03T14:38:07Z")

</div>

Problem solved.  
It is because of a directory permission "/var/log/elastic". I changed the owner of this directory to "elastic" and problem solved.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [October 31, 2017, 2:38pm UTC](https://discuss.elastic.co/t/error-bad-gateway/102413/6 "2017-10-31T14:38:29Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
