# Nginx.conf rewritten

**URL:** <https://www.ruby-forum.com/t/nginx-conf-rewritten/171116>\
**Category:** NGINX\
**Created:** [June 26, 2009, 5:08pm UTC](https://www.ruby-forum.com/t/nginx-conf-rewritten/171116 "2009-06-26T17:08:56Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pedro\_Mata-Mouros\_F](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/dec6dc/32.png) [@Pedro\_Mata-Mouros\_F](https://www.ruby-forum.com/u/Pedro_Mata-Mouros_F)\
**Post date:** [June 26, 2009, 5:08pm UTC](https://www.ruby-forum.com/t/nginx-conf-rewritten/171116/1 "2009-06-26T17:08:56Z")

</div>

Greetings,

It seems that /etc/nginx.conf gets replaced by the default in each new  
nginx install. Do you confirm this? Any chance it doesn’t replace that  
file, if it exists already, by default?

Thank you.

Pedro.

---

<div class="post-metadata">

**Author:** ![Pedro\_Mata-Mouros\_F](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/dec6dc/32.png) [@Pedro\_Mata-Mouros\_F](https://www.ruby-forum.com/u/Pedro_Mata-Mouros_F)\
**Post date:** [June 26, 2009, 5:37pm UTC](https://www.ruby-forum.com/t/nginx-conf-rewritten/171116/2 "2009-06-26T17:37:42Z")

</div>

Hello!

On Fri, Jun 26, 2009 at 04:02:23PM +0100, Pedro Mata-Mouros Fonseca  
wrote:

> Greetings,
> 
> It seems that /etc/nginx.conf gets replaced by the default in each new  
> nginx install. Do you confirm this? Any chance it doesn’t replace that  
> file, if it exists already, by default?

When you compile and install nginx from sources by hand it doesn’t  
happen, as well as for nginx (re)installed from FreeBSD port.

But as long as you mention ‘/etc/nginx.conf’ it looks like you are  
using some linux package, and probably it’s a good idea to look  
into it and ask your package maintainer to fix this if it’s really  
happens.

Maxim D.

---

<div class="post-metadata">

**Author:** ![Pedro\_Mata-Mouros\_F](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/dec6dc/32.png) [@Pedro\_Mata-Mouros\_F](https://www.ruby-forum.com/u/Pedro_Mata-Mouros_F)\
**Post date:** [June 27, 2009, 12:08pm UTC](https://www.ruby-forum.com/t/nginx-conf-rewritten/171116/3 "2009-06-27T12:08:23Z")

</div>

Hello!

On Fri, Jun 26, 2009 at 05:27:10PM +0100, Pedro Mata-Mouros Fonseca  
wrote:

> test -d ‘/servers/nginx-0.7.60/logs’ || mkdir -p '/  
> nginx.conf, not changing its name. Since I use a init.d script for  
> starting up nginx, configured to use /etc/nginx.conf, this file always is  
> replaced in this situation on every new install.
> 
> It’s not really important, maybe it can be fixed when somebody has 1  
> minute spare.  
> Thanks.

Thank you, nice catch. It’s regression introduced in 0.6.6.  
Patch attached.

Maxim D.

---

<div class="post-metadata">

**Author:** ![Pedro\_Mata-Mouros\_F](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/dec6dc/32.png) [@Pedro\_Mata-Mouros\_F](https://www.ruby-forum.com/u/Pedro_Mata-Mouros_F)\
**Post date:** [June 27, 2009, 11:39am UTC](https://www.ruby-forum.com/t/nginx-conf-rewritten/171116/4 "2009-06-27T11:39:43Z")

</div>

Yes, I’m compiling from sources. I found out what the problem is:

$ ./configure --prefix=/servers/nginx-0.7.60 --conf-path=/etc/ngix.conf  
$ make

# make install

[SNIP]  
test -f ‘/etc/ngix.conf’ || cp conf/nginx.conf ‘/etc’  
cp conf/nginx.conf ‘/etc/nginx.conf.default’  
test -d ‘/servers/nginx-0.7.60/logs’ || mkdir -p ‘/servers/  
nginx-0.7.60/logs’  
test -d ‘/servers/nginx-0.7.60/logs’ || mkdir -p ‘/  
servers/nginx-0.7.60/logs’  
test -d ‘/servers/nginx-0.7.60/html’ || cp -r html ‘/  
servers/nginx-0.7.60’  
test -d ‘/servers/nginx-0.7.60/logs’ || mkdir -p ‘/  
servers/nginx-0.7.60/logs’  
make[1]: Leaving directory `/servers/sources/nginx-0.7.60’

In the configure line I made a mistake and stated /etc/ngix.conf as  
the config file (notice the lack of the n). When installing, the  
script stats /etc/ngix.conf, and as it doesn’t exist, it copies the  
default nginx.conf, not changing its name. Since I use a init.d script  
for starting up nginx, configured to use /etc/nginx.conf, this file  
always is replaced in this situation on every new install.

It’s not really important, maybe it can be fixed when somebody has 1  
minute spare.  
Thanks.
