Nginx alert could not open error log file createfile

I have an Nginx service that's configured to start automatically on my Windows 10; however, this morning, the service wouldn't start. The error log says: nginx: [alert] could not open error log fi...

I have an Nginx service that’s configured to start automatically on my Windows 10; however, this morning, the service wouldn’t start.
The error log says: nginx: [alert] could not open error log file: CreateFile() "C:someForlderNamebuilddistribution.nginx/logs/error.log" failed (3: The system cannot find the path specified)

Looking at the path in the error log above, I do NOT have the /logs/ folder on my local system so it looks like Nginx doesn’t have the proper permissions to create that folder?

I’m setup as an admin user and my service is set to Log On As — Local System Account

This only happens on Windows 10; but the service starts and works on
older Windows i.e 8.1

So does anyone know how to grant administrator’s permissions to Nginx so that Nginx can create folders and files on Windows 10 ?

asked Feb 19, 2016 at 17:12

pelican's user avatar

pelicanpelican

5,5668 gold badges40 silver badges66 bronze badges

You need:

To install nginx/Windows, download the latest mainline version distribution (1.13.8), since the mainline branch of nginx contains all known fixes. Then unpack the distribution, go to the nginx-1.13.8 directory, and run nginx. Here is an example for the drive C: root directory: (Run cmd as administrator)

cd c:
unzip nginx-1.13.8.zip
cd nginx-1.13.8
start nginx

Go to: http://localhost:80 -> test install

Goback to console cmd: «nginx -s stop»

Run for next time:

  1. Config with file: «C:nginx-1.13.8confnginx.conf»
  2. Open cmd as administrator
  3. Run bash: «cd C:nginx-1.13.8»
  4. Run nginx with bash: «start nginx» . If you run with bash: «nginx», will get trouble for exit nginx.
  5. And

    nginx -s stop #fast shutdown

    nginx -s quit #graceful shutdown

    nginx -s reload #changing configuration, starting new worker processes with a new configuration, graceful shutdown of old worker processes

    nginx -s reopen #re-opening log files

answered Jan 17, 2018 at 3:01

Diep Gepa's user avatar

Diep GepaDiep Gepa

4795 silver badges5 bronze badges

1

Under the directory that you run nginx.exe, try to create a directory named logs, and a file named error.log under log.
It should pass this error.

answered Sep 19, 2016 at 22:40

Richard Li's user avatar

Richard LiRichard Li

3861 silver badge14 bronze badges

2

  1. After downloading zip file, you have unzip.
  2. Make sure that you dont have nested folder names. You have to copy your folder which has nginx.exe file in it, and paste it into C:/ folder.
  3. While running commands, like nginx -s stop, make sure that current your working directory is same as the nginx.exe file.
    enter image description here

answered Apr 1, 2020 at 11:20

David Wahid's user avatar

1

Nginx start on default port 80, not 8080. Try localhost:80 on browser.

If you want to change port, open C:nginx-1.16.1confnginx.conf with text editor.
change port number what you want use default port.

server {
    listen       80;
    server_name  localhost;
to:

server {
    listen       8080;
    server_name  localhost;

answered Jan 11, 2020 at 16:09

harun ugur's user avatar

harun ugurharun ugur

1,64418 silver badges17 bronze badges

I had a similar issue with starting the nginx server, but after looking at it closely and trying to run the command in different consoles, I realized it just a simple issue of a missing path.

How I solved it was to cd into the containing folder for the nginx.exe file (which actually contains error logs and all the necessary files) and then run the nginx command which started the server and fixed it for me.

answered Jun 10, 2021 at 23:17

Eric McWinNEr's user avatar

I have an Nginx service that’s configured to start automatically on my Windows 10; however, this morning, the service wouldn’t start.
The error log says: nginx: [alert] could not open error log file: CreateFile() "C:someForlderNamebuilddistribution.nginx/logs/error.log" failed (3: The system cannot find the path specified)

Looking at the path in the error log above, I do NOT have the /logs/ folder on my local system so it looks like Nginx doesn’t have the proper permissions to create that folder?

I’m setup as an admin user and my service is set to Log On As — Local System Account

This only happens on Windows 10; but the service starts and works on
older Windows i.e 8.1

So does anyone know how to grant administrator’s permissions to Nginx so that Nginx can create folders and files on Windows 10 ?

asked Feb 19, 2016 at 17:12

pelican's user avatar

pelicanpelican

5,5668 gold badges40 silver badges66 bronze badges

You need:

To install nginx/Windows, download the latest mainline version distribution (1.13.8), since the mainline branch of nginx contains all known fixes. Then unpack the distribution, go to the nginx-1.13.8 directory, and run nginx. Here is an example for the drive C: root directory: (Run cmd as administrator)

cd c:
unzip nginx-1.13.8.zip
cd nginx-1.13.8
start nginx

Go to: http://localhost:80 -> test install

Goback to console cmd: «nginx -s stop»

Run for next time:

  1. Config with file: «C:nginx-1.13.8confnginx.conf»
  2. Open cmd as administrator
  3. Run bash: «cd C:nginx-1.13.8»
  4. Run nginx with bash: «start nginx» . If you run with bash: «nginx», will get trouble for exit nginx.
  5. And

    nginx -s stop #fast shutdown

    nginx -s quit #graceful shutdown

    nginx -s reload #changing configuration, starting new worker processes with a new configuration, graceful shutdown of old worker processes

    nginx -s reopen #re-opening log files

answered Jan 17, 2018 at 3:01

Diep Gepa's user avatar

Diep GepaDiep Gepa

4795 silver badges5 bronze badges

1

Under the directory that you run nginx.exe, try to create a directory named logs, and a file named error.log under log.
It should pass this error.

answered Sep 19, 2016 at 22:40

Richard Li's user avatar

Richard LiRichard Li

3861 silver badge14 bronze badges

2

  1. After downloading zip file, you have unzip.
  2. Make sure that you dont have nested folder names. You have to copy your folder which has nginx.exe file in it, and paste it into C:/ folder.
  3. While running commands, like nginx -s stop, make sure that current your working directory is same as the nginx.exe file.
    enter image description here

answered Apr 1, 2020 at 11:20

David Wahid's user avatar

1

Nginx start on default port 80, not 8080. Try localhost:80 on browser.

If you want to change port, open C:nginx-1.16.1confnginx.conf with text editor.
change port number what you want use default port.

server {
    listen       80;
    server_name  localhost;
to:

server {
    listen       8080;
    server_name  localhost;

answered Jan 11, 2020 at 16:09

harun ugur's user avatar

harun ugurharun ugur

1,64418 silver badges17 bronze badges

I had a similar issue with starting the nginx server, but after looking at it closely and trying to run the command in different consoles, I realized it just a simple issue of a missing path.

How I solved it was to cd into the containing folder for the nginx.exe file (which actually contains error logs and all the necessary files) and then run the nginx command which started the server and fixed it for me.

answered Jun 10, 2021 at 23:17

Eric McWinNEr's user avatar

Crex crex

Сообщения: 2
Зарегистрирован: 2017.04.21, 06:51

Помогите настроить Nginx, пожалуйста.

Пытаюсь поднять на локали проект, уже стабильно работающий на хостинге. То есть с настройками UrlManager’а и роутингом явно все ОК. На хостинге проект поднят не мной, вопрос настройки хостинга в документации освещен слабо.
Дано: OpenServer, Nginx 1.8, шаблон Yii2 advanced. По адресу домена запускается фронт, по адресу cp.mydomain запускается бэкенд. Ну то есть на локали фронтенд тоже работает ОК, а вот бэкенд не запускается, выдает серверную 404 при любом запросе. Что я делаю не так?

Конфиг локального сервера (на базе стандартного):

Код: Выделить всё

server {
	charset utf-8;
	client_max_body_size 128M;
	
        listen	%ip%:%httpport%;
	server_name  cp.%host%; 
	root   "%hostdir%/backend/web";
	#root   "%host%/backend/web";
	index  index.php;
}

server {

	charset utf-8;
	client_max_body_size 128M;

    listen         %ip%:%httpport%;
    listen         %ip%:%httpsport% ssl;
    server_name    %host% %aliases%;
    # if ($request_method !~* ^(GET|HEAD|POST)$ ){return 403;}
    location ~ /. {deny all;}


    location / {
        root       "%hostdir%/frontend/web";
        index      index.php;
	try_files $uri $uri/ /index.php?$args;
	#try_files $uri $uri/ /index.php?$query_string;
    }


    location ~ .php$ {
        root                               "%hostdir%/frontend/web";
        try_files                          $uri =404;
        # if (!-e $document_root$document_uri){return 404;}
        fastcgi_pass                       backend;
        fastcgi_index                      index.php;
        fastcgi_buffers                    4 64k;
        fastcgi_connect_timeout            1s;
        fastcgi_ignore_client_abort        off;
        fastcgi_next_upstream              timeout;
        fastcgi_read_timeout               5m;
        fastcgi_send_timeout               5m;
        fastcgi_param    CONTENT_TYPE      $content_type;
        fastcgi_param    CONTENT_LENGTH    $content_length;
        fastcgi_param    DOCUMENT_URI      $document_uri;
        fastcgi_param    DOCUMENT_ROOT     $document_root;
        fastcgi_param    GATEWAY_INTERFACE CGI/1.1;
        fastcgi_param    HTTPS             $https;
        fastcgi_param    QUERY_STRING      $query_string;
        fastcgi_param    REQUEST_METHOD    $request_method;
        fastcgi_param    REQUEST_URI       $request_uri;
        fastcgi_param    REMOTE_ADDR       $remote_addr;
        fastcgi_param    REMOTE_PORT       $remote_port;
        fastcgi_param    SERVER_ADDR       $server_addr;
        fastcgi_param    SERVER_PORT       $server_port;
        fastcgi_param    SERVER_NAME       $host;
        fastcgi_param    SERVER_PROTOCOL   $server_protocol;
        fastcgi_param    SERVER_SOFTWARE   nginx;
        fastcgi_param    SCRIPT_FILENAME   $document_root$fastcgi_script_name;
        fastcgi_param    SCRIPT_NAME       $fastcgi_script_name;
        fastcgi_param    TMP               "%sprogdir%/userdata/temp";
        fastcgi_param    TMPDIR            "%sprogdir%/userdata/temp";
        fastcgi_param    TEMP              "%sprogdir%/userdata/temp";
    }


    location /openserver/ {
        root     "%sprogdir%/modules/system/html";
        index    index.php;
        %allow%allow    all;
        allow    127.0.0.0/8;
        allow    ::1/128;
        allow    %ips%;
        deny     all;
        location /openserver/server-status {
            stub_status on;
        }
        location ~ ^/openserver/.*.php$ {
            root                               "%sprogdir%/modules/system/html";
            fastcgi_pass                       backend;
            fastcgi_index                      index.php;
            fastcgi_buffers                    4 64k;
            fastcgi_connect_timeout            1s;
            fastcgi_ignore_client_abort        off;
            fastcgi_next_upstream              timeout;
            fastcgi_read_timeout               5m;
            fastcgi_send_timeout               5m;
            fastcgi_param    CONTENT_TYPE      $content_type;
            fastcgi_param    CONTENT_LENGTH    $content_length;
            fastcgi_param    DOCUMENT_URI      $document_uri;
            fastcgi_param    DOCUMENT_ROOT     $document_root;
            fastcgi_param    GATEWAY_INTERFACE CGI/1.1;
            fastcgi_param    HTTPS             $https;
            fastcgi_param    QUERY_STRING      $query_string;
            fastcgi_param    REQUEST_METHOD    $request_method;
            fastcgi_param    REQUEST_URI       $request_uri;
            fastcgi_param    REMOTE_ADDR       $remote_addr;
            fastcgi_param    REMOTE_PORT       $remote_port;
            fastcgi_param    SERVER_ADDR       $server_addr;
            fastcgi_param    SERVER_PORT       $server_port;
            fastcgi_param    SERVER_NAME       $host;
            fastcgi_param    SERVER_PROTOCOL   $server_protocol;
            fastcgi_param    SERVER_SOFTWARE   nginx;
            fastcgi_param    SCRIPT_FILENAME   $document_root$fastcgi_script_name;
            fastcgi_param    SCRIPT_NAME       $fastcgi_script_name;
            fastcgi_param    TMP               "%sprogdir%/userdata/temp";
            fastcgi_param    TMPDIR            "%sprogdir%/userdata/temp";
            fastcgi_param    TEMP              "%sprogdir%/userdata/temp";
        }
    }

}

Crex crex

Сообщения: 2
Зарегистрирован: 2017.04.21, 06:51

Re: Помогите настроить Nginx, пожалуйста.

Сообщение

Crex crex » 2017.05.10, 05:09

Вещает, что

Код: Выделить всё

nginx: [alert] could not open error log file: CreateFile() "logs/error.log" failed (3: The system cannot find the path specified)
2017/05/10 05:06:32 [emerg] 3364#6100: CreateFile() "d:openserver/conf/nginx.conf" failed (3: The system cannot find the path specified)
nginx: configuration file d:openserver/conf/nginx.conf test failed

В логах Nginx-отладки пишет:

Код: Выделить всё

2017/05/10 04:58:17 [error] 5884#5912: *1 CreateFile() "d:/openserver/domains/mydomain/backend/web/en/login" failed (3: The system cannot find the path specified), client: 127.0.0.1, server: cp.mydomain, request: "GET /en/login? HTTP/1.1", host: "cp.mydomain"

denisflen

Сообщения: 4
Зарегистрирован: 23 фев 2019, 22:09

Не работает laravel 5.2 на чистом nginx 1.14

Добрый день.
Столкнулся с проблемой.
В OS 5.2.9 сайт на laravel 5.2 работает на связке Apache+PHP-7-x64+Nginx-1.14 и PHP-7.0-x64, но не работает на чистом Nginx-1.14 и PHP-7.0-x64.

nginx -t:

nginx: [alert] could not open error log file: CreateFile() «logs/error.log» failed (3: The system cannot find the path specified)
2019/02/23 22:18:48 [emerg] 8848#1820: CreateFile() «d:webservershomedomain.locwww/conf/nginx.conf» failed (3: The system cannot find the path specified)
nginx: configuration file d:webservershomedomain.locwww/conf/nginx.conf test failed

Логи nginx:

2019/02/23 21:50:33 [error] 7792#7100: *54 CreateFile() «d:/webservers/home/domain.loc/www/public/test» failed (2: The system cannot find the file specified), client: 127.0.0.1, server: domain.loc, request: «GET /test HTTP/1.1», host: «domain.loc»

Пожалуйста, подскажите как решить?
Благодарю.

denisflen

Сообщения: 4
Зарегистрирован: 23 фев 2019, 22:09

Re: Не работает laravel 5.2 на чистом nginx 1.14

Непрочитанное сообщение

denisflen » 23 фев 2019, 23:24

Решение:
1. Настроить домен в Настройки => вкладка «Домены»

domain.loc => /domain.loc/www/public

2. Скопировать файл ospanel/userdata/config/Nginx-1.14_vhost.conf в папку home/domain.loc/www/public

3. Изменить секцию в /domain.loc/www/public/Nginx-1.14_vhost.conf

    
    location / {
        root       "%hostdir%";
        index      index.php index.html index.htm;
	try_files $uri $uri/ /index.php?$query_string;
    }

4. Перезапустить сервер

Понравилась статья? Поделить с друзьями:
  • Nfsend connect error permission denied
  • Nfs16 exe ошибка при запуске приложения 0xc000007b
  • Nginx 505 error
  • Nginx 504 timeout error
  • Nfs ошибка сети 53