# Limit access to files in cgi-bin

**URL:** <https://www.ruby-forum.com/t/limit-access-to-files-in-cgi-bin/224909>\
**Category:** NGINX\
**Created:** [December 1, 2012, 4:39pm UTC](https://www.ruby-forum.com/t/limit-access-to-files-in-cgi-bin/224909 "2012-12-01T16:39:12Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![aris](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/258eb7/32.png) [@aris](https://www.ruby-forum.com/u/aris)\
**Post date:** [December 1, 2012, 4:39pm UTC](https://www.ruby-forum.com/t/limit-access-to-files-in-cgi-bin/224909/1 "2012-12-01T16:39:12Z")

</div>

Hello,

I have a configuration file located at (example)  
[http://domain.com:82/cgi-bin/xxx.pm](http://domain.com:82/cgi-bin/xxx.pm) that can be accessed by anyone if  
they  
know the address/file location. Is there a way to limit access to this  
location from outside the server? I mean so no one can access it if they  
go  
to that url?

I tried with rewrite but my main server must communicate with this file  
located in cgi-bin and when rewrite is enabled the main server can’t  
communicate with that file either. Please advise.

Thank you!

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [December 1, 2012, 4:43pm UTC](https://www.ruby-forum.com/t/limit-access-to-files-in-cgi-bin/224909/2 "2012-12-01T16:43:19Z")

</div>

On 1 December 2012 14:26, [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> communicate with that file either. Please advise.  
> You could look at [Module ngx\_http\_core\_module](http://nginx.org/r/internal) or, if that doesn’t  
> quite fit the bill, [GitHub - nginxinc/nginx-wiki: ARCHIVED -- Source for the now archived NGINX Wiki section of https://www.nginx.com · GitHub](http://wiki.nginx.org/HttpAccessModule)

## HTH, Jonathan

Jonathan M. // Oxford, London, UK

> **[Jonathan Matthews :: Words Typed, Great Rates For Cash](https://www.jpluscplusm.com)**
