# Running InfluxDB API behind nginx (reverse proxy)

**URL:** <https://community.influxdata.com/t/running-influxdb-api-behind-nginx-reverse-proxy/25898>\
**Category:** Systems\
**Created:** [July 28, 2022, 1:56am UTC](https://community.influxdata.com/t/running-influxdb-api-behind-nginx-reverse-proxy/25898 "2022-07-28T01:56:41Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Henjoe\_Gutierrez](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/henjoe_gutierrez/32/5157_2.png) [@Henjoe\_Gutierrez](https://community.influxdata.com/u/Henjoe_Gutierrez)\
**Post date:** [July 28, 2022, 1:56am UTC](https://community.influxdata.com/t/running-influxdb-api-behind-nginx-reverse-proxy/25898/1 "2022-07-28T01:56:41Z")

</div>

Hi I wonder if someone experience what I have experience when running influxdb behind nginx.  
So here is the scenario:

I have influxdb instance running on my local machine, I want my machine’s firewall to only open on port 443 (https), so I set up a reverse proxy (nginx) so that it proxy the influxdb API which is running on port 8086.  
All influx client should query data using that nginx (https//ipadd/db) not in [https://ipadd:8086/query](https://ipadd:8086/query).  
This is actually work’s fine, the client can get response from the nginx server, howevever this is what I experience.  
When quering the data thru nginx, the response is slow (it almost took 3s) while getting the data thru the port 8086 (by passing the nginx), the response is almost in milleseconds only.  
I don’t if it has something to do with my config on my nginx, so here what I have now:  
 ![image](https://us1.discourse-cdn.com/flex023/uploads/influxdata/original/2X/a/a0848319031421a4dbc437a714ea6ca5c1278d4e.png)

Am I doing wrong with my configuration that is why it slows down the response?

Thank you.

Regards,  
Henjoe

---

<div class="post-metadata">

**Author:** ![Anaisdg](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/anaisdg/32/6401_2.png) [@Anaisdg](https://community.influxdata.com/u/Anaisdg)\
**Post date:** [August 1, 2022, 5:55pm UTC](https://community.influxdata.com/t/running-influxdb-api-behind-nginx-reverse-proxy/25898/2 "2022-08-01T17:55:04Z")

</div>

Hello @Henjoe_Gutierrez,  
I think that your conclusion sounds right if without nginx the response is fast. I haven’t used nginx much so I don’t know. Perhaps you can try asking here?

> **[Nginx Forum](https://forum.nginx.org/)**
>
> Mailing List Integration and More!

Let me also tag @Jay_Clifford in case he knows.

---

<div class="post-metadata">

**Author:** ![Jay\_Clifford](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/jay_clifford/32/8287_2.png) [@Jay\_Clifford](https://community.influxdata.com/u/Jay_Clifford)\
**Post date:** [August 3, 2022, 12:12pm UTC](https://community.influxdata.com/t/running-influxdb-api-behind-nginx-reverse-proxy/25898/3 "2022-08-03T12:12:08Z")

</div>

Hi @Henjoe_Gutierrez,  
Yeah, I would check the nginx logs and see if they elude to any issues. I agree this might be an issue to post on their forums. If not hopefully one of our community users might see and pick this up.

---

<div class="post-metadata">

**Author:** ![Henjoe\_Gutierrez](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/henjoe_gutierrez/32/5157_2.png) [@Henjoe\_Gutierrez](https://community.influxdata.com/u/Henjoe_Gutierrez)\
**Post date:** [August 3, 2022, 2:05pm UTC](https://community.influxdata.com/t/running-influxdb-api-behind-nginx-reverse-proxy/25898/4 "2022-08-03T14:05:49Z")

</div>

Hi @Jay_Clifford  
I think I already solve it. This sounds weird but by just changing the “localhost” to 127.0.0.1 solved the problem.

Thanks!

Regards,  
Henjoe
