Could Not Open Error Log File Open /var/log/nginx/error.log
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up How to turn off or specify the nginx error log location? up vote 14 down vote favorite 3 I compiled the nginx on Ubuntu myself. I start my nginx with -c nginx.conf parameter. In my nginx.conf file, I try to turn off error log with but failed. error_log /dev/null crit; Still got the error message: nginx: [alert] could not open error log file: open() "/usr/nginx/logs/error.log" failed (2: No such file or directory) How could I turn off this log or change its location? nginx share|improve this question asked Nov 14 '12 at 1:54 Dean Chen 1,41432247 Have you tried removing the error_log declaration (your line)? :) –Sean3z Nov 14 '12 at 2:43 I tried just now, only use access_log, but still got the error message. I didn't create the folder:/home/dist/carrier/nginx/logs. Restarting nginx: nginx: [alert] could not open error log file: open() "/home/dist/carrier/nginx/logs/error.log" failed (2: No such file or directory –Dean Chen Nov 14 '12 at 7:23 add a comment| 4 Answers 4 active oldest votes up vote 13 down vote accepted The syntax for disabling the error log is ok, but the docs state that a default logfile is used before the config is read. (which seems reasonable because how would it otherwise tell you you have an error in your config) Try creating this file by hand with the correct permissions for the user that runs nginx. Or try starting the server as root. share|improve this answer answered Nov 14 '12 at 13:21 RickyA 5,83523057 That's what I have done. use --prefix when compiling nginx to set the correct logs location and create the folder when installing my nginx service. –Dean Chen Nov 15 '12 at 11:51 $ sudo chmod a+w /var/log/nginx
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Nginx still try to open default error log file even though I set nginx config file while reloading up vote 4 down http://stackoverflow.com/questions/13371925/how-to-turn-off-or-specify-the-nginx-error-log-location vote favorite The below is my nginx configuration file located in /etc/nginx/nginx.conf user Foo; worker_processes 1; error_log /home/Foo/log/nginx/error.log; pid /home/Foo/run/nginx.pid; events { worker_connections 1024; use epoll; } http { access_log /home/Foo/log/nginx/access.log; server { listen 80; location = / { proxy_pass http://192.168.0.16:9999; } } } As you can see I change log, pid files location into home directory. When I re-start Linux it seems to work, Nginx records error logs in the file I set http://stackoverflow.com/questions/34258894/nginx-still-try-to-open-default-error-log-file-even-though-i-set-nginx-config-fi and pid file also. However, when it tries nginx -s reload or the other, It tries to open other error log file. nginx: [alert] could not open error log file: open() "/var/log/nginx/error.log" failed (13: Permission denied) 2015/12/14 11:23:54 [warn] 3356#0: the "user" directive makes sense only if the master process runs with super-user privileges, ignored in /etc/nginx/nginx.conf:1 nginx: the configuration file /etc/nginx/nginx.conf syntax is ok 2015/12/14 11:23:54 [emerg] 3356#0: open() "/home/Foo/run/nginx.pid" failed (13: Permission denied) nginx: configuration file /etc/nginx/nginx.conf test failed I know, I can solve permission error with sudo but the main issue in here is a error log file(/var/log/nginx/error.log) Nginx tries to open. Why does it try to access another error log file? linux nginx config share|improve this question asked Dec 14 '15 at 2:29 asleea 730727 add a comment| 2 Answers 2 active oldest votes up vote 2 down vote accepted Check the permissions on the directory /home/Foo/log/nginx/. It must be writable by nginx. Set permissions like so: sudo chmod 766 /home/Foo/log/nginx share|improve this answer answered Dec 14 '15 at 2:34 cantelope 84818 I am asking why Nginx try to access another error log file not a permission problem. Even if there is a permission problem. I think the error show error on the file I set in configuration file(/home/Foo/log/nginx) not /var/log/nginx/error.log. –asleea Dec
] [ thread ] [ subject ] [ author ] On Fri, Jul 03, 2009 at 04:43:13PM +0400, could not Alexey Vlasov wrote: > Привет друзья. > > # /opt/sbin/nginx -t > [alert]: could not open error log file: open() > "/var/log/nginx" failed (21: Is a directory) > the configuration could not open file /etc/nginx/nginx.conf syntax is ok > configuration file /etc/nginx/nginx.conf test is successful > > # /opt/sbin/nginx -v > nginx version: nginx/0.7.61 > > В /etc/nginx/nginx.conf написано: > error_log /var/log/nginx/error.log; > > Может что изменилось в последних версиях? Скорее всего --error-log=/var/log/nginx nginx -V -- Игорь Сысоев http://sysoev.ru Previous message: [alert]: could not open error log file Next message: [alert]: could not open error log file Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] More information about the nginx-ru mailing list
Start here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Server Fault Questions Tags Users Badges Unanswered Ask Question _ Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute: Sign up Here's how it works: Anybody can ask a question Anybody can answer The best answers are voted up and rise to the top nginx tries opening logs in /var even when I direct logs elsewhere up vote 0 down vote favorite I'm trying to run nginx as a non-privileged user--specifically, my usual login ID. I find that I cannot start nginx successfully, since it insists on trying to open log files in /var/log/nginx/, even when the config file I provide tells it to store those files elsewhere. Specifically, I invoke nginx like this: $ nginx -c ~/my-nginx.conf The config file mentioned in that command has this form: pid /home/me/nginx/nginx.pid; events { worker_connections 1024; } http { access_log /home/me/nginx/access.log; error_log /home/me/nginx/error.log; # many more lines omitted } None of the omitted lines contain access_log or error_log directives, nor do any of the few files that are included via the include directive. nginx always dies after printing these lines: nginx: [alert] could not open error log file: open() "/var/log/nginx/error.log" failed (13: Permission denied) 2016/06/13 12:43:54 [emerg] 4473#0: open() "/var/log/nginx/error.log" failed (13: Permission denied) It does create the log files mentioned in the config file with zero length before dying, however. Why does nginx try to open these files, and how can it be prevented from doing so? nginx share|improve this question asked Jun 13 at 20:07 Sean 1175 add a comment| 1 Answer 1 active oldest votes up vote 1 down vote accepted You've put your error_log directive at the http level. This directive can be made at a higher level. Try copying your directive to the top of the nginx.conf file, outside the HTTP block. share|improve this answer answered Jun 13 at 20:44 T