# Overriding configuration variables, specifically access\_log

**URL:** <https://www.ruby-forum.com/t/overriding-configuration-variables-specifically-access-log/210846>\
**Category:** NGINX\
**Created:** [August 18, 2011, 6:37pm UTC](https://www.ruby-forum.com/t/overriding-configuration-variables-specifically-access-log/210846 "2011-08-18T18:37:19Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![luislavena](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/0ea827/32.png) [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Post date:** [August 18, 2011, 6:37pm UTC](https://www.ruby-forum.com/t/overriding-configuration-variables-specifically-access-log/210846/1 "2011-08-18T18:37:19Z")

</div>

We are using nginx/1.0.5 from the nginx apt repositories and have  
noticed  
that when setting the access\_log directive in /etc/nginx/conf.d/common,  
it  
does nothing unless I comment out the access\_log directive above it in  
/etc/nginx/nginx.conf.

It appears that the variable is evaluated only the first time in any  
given  
block (in this case inside the http { } block) and cannot be overridden.  
Is  
that the case?

If so, I think the best solution is to move the access\_log directive  
inside  
each of the individual location { } blocks where I need it so as not to  
interfere with the stock nginx.conf file.

The only other alternative I can think of is to overwrite the nginx.conf  
file entirely - I’m concerned about doing that because I don’t want that  
file overwritten by the nginx aptitude installer in the future.

Does anybody have a good solution to this?

## Cheers, Adam

UX/UI/IA positions available @ [http://yipit.com/about/jobs/](http://yipit.com/about/jobs/)

---

<div class="post-metadata">

**Author:** ![Adam\_Nelson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/8edcca/32.png) [@Adam\_Nelson](https://www.ruby-forum.com/u/Adam_Nelson)\
**Post date:** [August 18, 2011, 6:49pm UTC](https://www.ruby-forum.com/t/overriding-configuration-variables-specifically-access-log/210846/2 "2011-08-18T18:49:42Z")

</div>

On 08/18/11 17:36, Adam Nelson wrote:

> The only other alternative I can think of is to overwrite the nginx.conf file  
> entirely - I’m concerned about doing that because I don’t want that file  
> overwritten by the nginx aptitude installer in the future.

Aptitude (on Debian) won’t overwrite nginx.conf if it has been changed.  
Instead it will install the distributed version as nginx.conf.dpkg-dist.

It may prompt to ask if you want to overwrite but you just say no.

Dick

---

<div class="post-metadata">

**Author:** ![Adam\_Nelson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/8edcca/32.png) [@Adam\_Nelson](https://www.ruby-forum.com/u/Adam_Nelson)\
**Post date:** [August 18, 2011, 6:53pm UTC](https://www.ruby-forum.com/t/overriding-configuration-variables-specifically-access-log/210846/3 "2011-08-18T18:53:25Z")

</div>

On Thu, Aug 18, 2011 at 12:49 PM, Dick M. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> It may prompt to ask if you want to overwrite but you just say no.
> 
> Dick

I’d still prefer to customize via conf.d/ if at all possible - that’s  
what  
the folder is there for after all. I’ll do that if necessary though.

Thanks,  
Adam

---

<div class="post-metadata">

**Author:** ![Adam\_Nelson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/8edcca/32.png) [@Adam\_Nelson](https://www.ruby-forum.com/u/Adam_Nelson)\
**Post date:** [August 18, 2011, 7:02pm UTC](https://www.ruby-forum.com/t/overriding-configuration-variables-specifically-access-log/210846/4 "2011-08-18T19:02:07Z")

</div>

On Thu, Aug 18, 2011 at 12:36:30PM -0400, Adam Nelson wrote:

> each of the individual location { } blocks where I need it so as not to  
> interfere with the stock nginx.conf file.
> 
> The only other alternative I can think of is to overwrite the nginx.conf  
> file entirely - I’m concerned about doing that because I don’t want that  
> file overwritten by the nginx aptitude installer in the future.
> 
> Does anybody have a good solution to this?

You can set several access\_log files on a level, so this is the reason  
why you can not override it.

–  
Igor S.
