# NGINX looks for /logs/error.log as default?

**URL:** <https://www.ruby-forum.com/t/nginx-looks-for-logs-error-log-as-default/223884>\
**Category:** NGINX\
**Created:** [October 22, 2012, 2:01pm UTC](https://www.ruby-forum.com/t/nginx-looks-for-logs-error-log-as-default/223884 "2012-10-22T14:01:44Z")\
**Posts on this page:** 4\
**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:** [October 22, 2012, 2:01pm UTC](https://www.ruby-forum.com/t/nginx-looks-for-logs-error-log-as-default/223884/1 "2012-10-22T14:01:44Z")

</div>

Hello, I have a problem with NGINX version 1.2.4 it will constantly look  
for /logs/error.log, even though I have defined another error.log in my  
configuration.

I start NGINX like this:  
nginx -p . -c config/nginx/development.conf

My development.conf is fairly simple and looks like this:

# main error log

error\_log log/nginx.error.log debug;  
worker\_processes 1;

events {  
worker\_connections 1024;  
}

http {  
include mime.types;  
default\_type application/octet-stream;

# main access log

access\_log log/nginx.access.log combined;

sendfile on;

keepalive\_timeout 65;

server {  
listen 9002; #omg!  
server\_name local.woman.dk;

```
rewrite ^/(.*)/$ /$1 last;

proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_max_temp_file_size 0;

location / {
  ssi on;
  proxy_pass http://127.0.0.1:3000;
}

```

}  
}

But NGINX don’t want to start because ./logs/error.log doesn’t exist.  
This  
is my error:

[ben2 (master)]=\> nginx -p . -c config/nginx/development.conf  
nginx: [alert] could not open error log file: open() “./logs/error.log”  
failed (2: No such file or directory)

Am I doing it wrong?

---

<div class="post-metadata">

**Author:** ![Kasper\_G](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/ecb155/32.png) [@Kasper\_G](https://www.ruby-forum.com/u/Kasper_G)\
**Post date:** [October 22, 2012, 3:24pm UTC](https://www.ruby-forum.com/t/nginx-looks-for-logs-error-log-as-default/223884/2 "2012-10-22T15:24:07Z")

</div>

On 22 Oct2012, at 16:01 , Kasper G. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Am I doing it wrong?

Nginx have to write log even before it read config file, so nginx try to  
open file specified  
by --error-log-path or relative to --prefix configure options.

---

<div class="post-metadata">

**Author:** ![Kasper\_G](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/ecb155/32.png) [@Kasper\_G](https://www.ruby-forum.com/u/Kasper_G)\
**Post date:** [October 22, 2012, 3:38pm UTC](https://www.ruby-forum.com/t/nginx-looks-for-logs-error-log-as-default/223884/3 "2012-10-22T15:38:08Z")

</div>

On Monday 22 October 2012 16:01:17 Kasper G. wrote:

> Hello, I have a problem with NGINX version 1.2.4 it will constantly look  
> for /logs/error.log, even though I have defined another error.log in my  
> configuration.  
> […]  
> But NGINX don’t want to start because ./logs/error.log doesn’t exist. This  
> is my error:
> 
> [ben2 (master)]=\> nginx -p . -c config/nginx/development.conf  
> nginx: [alert] could not open error log file: open() “./logs/error.log”  
> failed (2: No such file or directory)
> 
> Am I doing it wrong?

Nginx must have access to error log before it will parse configuration.  
See also the “–error-log-path=” configure parameter.

> **[Installing nginx](http://nginx.org/en/docs/install.html)**

wbr, Valentin V. Bartenev

–

> **[F5 NGINX: Built for cloud-native apps. Ready for AI traffic.](https://www.f5.com/products/nginx)**
>
> Deliver modern applications with NGINX. Explore high-performance load balancing, API gateways, and web server solutions trusted by top global enterprises.

> **[nginx: donation](http://nginx.org/en/donation.html)**

---

<div class="post-metadata">

**Author:** ![Kasper\_G](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/ecb155/32.png) [@Kasper\_G](https://www.ruby-forum.com/u/Kasper_G)\
**Post date:** [October 25, 2012, 10:45am UTC](https://www.ruby-forum.com/t/nginx-looks-for-logs-error-log-as-default/223884/4 "2012-10-25T10:45:22Z")

</div>

2012/10/22 Valentin V. Bartenev [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

> > nginx: [alert] could not open error log file: open() “./logs/error.log”  
> > –  
> > [NGINX | F5](http://nginx.com/support.html)  
> > [nginx: donation](http://nginx.org/en/donation.html)
> 
> * * *
> 
> nginx mailing list  
> [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> [mailman.nginx.org archive](http://mailman.nginx.org/mailman/listinfo/nginx)

Oh, that makes sense. Then I am not able to make a smart setup that I  
wanted. Thanks for your email.
