# Auth\_basic & avoiding duplication in conf file

**URL:** <https://www.ruby-forum.com/t/auth-basic-avoiding-duplication-in-conf-file/153175>\
**Category:** NGINX\
**Created:** [November 12, 2008, 11:13pm UTC](https://www.ruby-forum.com/t/auth-basic-avoiding-duplication-in-conf-file/153175 "2008-11-12T23:13:14Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![anr](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/a9adbd/32.png) [@anr](https://www.ruby-forum.com/u/anr)\
**Post date:** [November 12, 2008, 11:13pm UTC](https://www.ruby-forum.com/t/auth-basic-avoiding-duplication-in-conf-file/153175/1 "2008-11-12T23:13:14Z")

</div>

Hi,

Sorry if this is a faq. I started using v0.6.32 and I have to turn on  
/ off auth based on the url.

I have something like:

server {  
auth\_basic …

```
location ~* jpeg {
}

location /home/return {
    auth_basic off
}

location / {
    several_config_lines
}

```

}

The problem is, I would like “involved\_config” to apply to  
“/home/return” as well, but I don’t want to copy it there.

I can’t move it to server, because it shouldn’t apply to other  
location directives (eg jpeg).

Is there a clean way around it?

Thanks,

---

<div class="post-metadata">

**Author:** ![anr](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/a9adbd/32.png) [@anr](https://www.ruby-forum.com/u/anr)\
**Post date:** [November 12, 2008, 11:20pm UTC](https://www.ruby-forum.com/t/auth-basic-avoiding-duplication-in-conf-file/153175/2 "2008-11-12T23:20:51Z")

</div>

You can put it in an include and then include yourauthconf.conf;

That’s the quick and dirty idea…

---

<div class="post-metadata">

**Author:** ![anr](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/a9adbd/32.png) [@anr](https://www.ruby-forum.com/u/anr)\
**Post date:** [November 13, 2008, 2:13pm UTC](https://www.ruby-forum.com/t/auth-basic-avoiding-duplication-in-conf-file/153175/3 "2008-11-13T14:13:07Z")

</div>

On Wed, Nov 12, 2008 at 8:13 PM, mike [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> You can put it in an include and then include yourauthconf.conf;
> 
> That’s the quick and dirty idea…

Ah, very good. I feel better now 🙂

Thanks Mike!
