# How can restrict access to kibana using nginx

**URL:** <https://discuss.elastic.co/t/how-can-restrict-access-to-kibana-using-nginx/161021>\
**Category:** Kibana\
**Created:** [December 16, 2018, 11:06am UTC](https://discuss.elastic.co/t/how-can-restrict-access-to-kibana-using-nginx/161021 "2018-12-16T11:06:31Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![sahere37](https://avatars.discourse-cdn.com/v4/letter/s/b2d939/32.png) [@sahere37](https://discuss.elastic.co/u/sahere37)\
**Post date:** [December 16, 2018, 11:06am UTC](https://discuss.elastic.co/t/how-can-restrict-access-to-kibana-using-nginx/161021/1 "2018-12-16T11:06:31Z")

</div>

hi all,  
I install nginx to have authentication page in order to accessing a site (KIBANA console). for this purpose, i write following in /etc/nginx/conf.d/default.conf file

server {  
listen \*:80;  
server\_name \_;  
location / {  
proxy\_pass [http://192.168.170.149:5601](http://192.168.170.149:5601);  
auth\_basic "Restricted";  
auth\_basic\_user\_file /etc/nginx/.htpasswd;  
}

}

according this, when i using (localhost:80) it redirects to (192.168.170.149:5601) with an authentication page. but, when i directly enter 192.168.170.149:5601, it still can be accessible. is there any way which when i enter 192.168.170.149:5601, it redirects to authentication page?  
thanks

---

<div class="post-metadata">

**Author:** ![Nir\_Adler](https://avatars.discourse-cdn.com/v4/letter/n/ed8c4c/32.png) [@Nir\_Adler](https://discuss.elastic.co/u/Nir_Adler)\
**Post date:** [December 16, 2018, 4:08pm UTC](https://discuss.elastic.co/t/how-can-restrict-access-to-kibana-using-nginx/161021/2 "2018-12-16T16:08:01Z")

</div>

[reference guide](https://www.digitalocean.com/community/tutorials/how-to-install-elasticsearch-logstash-and-kibana-elastic-stack-on-ubuntu-18-04#)

nginix can and will block income connection (if used correctly), local connection will not be affected  
inside the machine 192.168.170.149:5601still running and accessible but income connection from the outside world on port 80 will be secure and proxy the kibana for you.

---

<div class="post-metadata">

**Author:** ![sahere37](https://avatars.discourse-cdn.com/v4/letter/s/b2d939/32.png) [@sahere37](https://discuss.elastic.co/u/sahere37)\
**Post date:** [December 27, 2018, 5:35am UTC](https://discuss.elastic.co/t/how-can-restrict-access-to-kibana-using-nginx/161021/3 "2018-12-27T05:35:59Z")

</div>

many thanks

---

<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:** [January 24, 2019, 5:36am UTC](https://discuss.elastic.co/t/how-can-restrict-access-to-kibana-using-nginx/161021/4 "2019-01-24T05:36:00Z")

</div>

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