# Nginx config for reverse proxying Kibana 5.1.1

**URL:** https://discuss.elastic.co/t/nginx-config-for-reverse-proxying-kibana-5-1-1/88051
**Category:** Kibana
**Created:** [June 2, 2017, 9:40am UTC](https://discuss.elastic.co/t/nginx-config-for-reverse-proxying-kibana-5-1-1/88051 "2017-06-02T09:40:28Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Ramya](https://avatars.discourse-cdn.com/v4/letter/r/e9c0ed/32.png) [@Ramya](https://discuss.elastic.co/u/Ramya)
#### Post date: [June 2, 2017, 9:40am UTC](https://discuss.elastic.co/t/nginx-config-for-reverse-proxying-kibana-5-1-1/88051/1 "2017-06-02T09:40:28Z")

</div>

I am newbie to Nginx and reverse proxy

I am struggling to make accessing of kibana through Nginx work with latest versions of Kibana Kibana 5.1.1

This is current config

server {  
listen 8070;  
location ~ /analytics/(?\<kibana\_uri\>.\*) {  
proxy\_pass [https://stag.xxxxx.xxxx.es.amazonaws.com:5601/$kibana\_uri;](https://stag.xxxxx.xxxx.es.amazonaws.com:5601/%24kibana_uri;)  
proxy\_http\_version 1.1;  
proxy\_set\_header Upgrade $http\_upgrade;  
proxy\_set\_header Connection 'upgrade';  
proxy\_set\_header Host $host;  
proxy\_cache\_bypass $http\_upgrade;  
}  
}

server.basepath : "/analytics"

I want to redirect all request for /analytics to my kibana server instance. but all I am getting is 404.Please help me with some example config if anyone has done it earlier.

And how should be the access link For eg: [http://server/analytics](http://server/analytics)

---

<div class="post-metadata">

### Author: ![weltenwort](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/weltenwort/32/53885_2.png) [@weltenwort](https://discuss.elastic.co/u/weltenwort)
#### Post date: [June 6, 2017, 2:21pm UTC](https://discuss.elastic.co/t/nginx-config-for-reverse-proxying-kibana-5-1-1/88051/2 "2017-06-06T14:21:57Z")

</div>

Hi @Ramya,

from your config snippet it looks like `$kibana_uri` is not defined. I guess for your purpose you want to assign that name to the regex capture group as in `location ~ /analytics/(?<kibana_uri>.*) {`.

To get `http://server/analytics` to work you probably also need to handle the case of the missing trailing slash. As suggested in [Can someone share nginx config for reverse proxying Kibana4.4/4,5](https://discuss.elastic.co/t/can-someone-share-nginx-config-for-reverse-proxying-kibana4-4-4-5/46326/9), this might do the trick:

```
location = /analytics {
   return 302 /analytics/;
}
```

---

<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: [July 4, 2017, 2:22pm UTC](https://discuss.elastic.co/t/nginx-config-for-reverse-proxying-kibana-5-1-1/88051/3 "2017-07-04T14:22:03Z")

</div>

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