2

First of all, hello everyone. This is my first question on this site, I will try to ask better questions, but for now, please forgive me.

When I start my remote server, I get an error. When viewing logs, I see

deploy@rails-deploy:~/www$ sudo cat /var/log/nginx/myapp.error.log
2021/01/09 14:14:09 [error] 11392#11392: *1 open() "/home/deploy/www/public/favicon.ico" failed (2: No such file or directory), client: 95.27.46.9, server: mydomain.com, request: "GET /favicon.ico HTTP/1.1", host: "159.65.205.188"

I tried to fix this error by following the questions found here. Nginx and favicon.ico - "GET /favicon.ico HTTP/1.1" FAILED and nginx: [emerg] "server" directive is not allowed here

Now my nginx. conf looks like this

http {
    server {
     location = /favicon.ico {
       return 204;
       access_log     off;
       log_not_found  off;
     } 
    }
#another code

I run sudo nginx -t but I don't get anything suspicious

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

Then I restart

sudo service nginx restart

And I go back to where I started

    deploy@rails-deploy:~/www$ sudo cat /var/log/nginx/myapp.error.log
2021/01/09 14:14:09 [error] 11392#11392: *1 open() "/home/deploy/www/public/favicon.ico" failed (2: No such file or directory), client: 95.27.46.9, server: mydomain.com, request: "GET /favicon.ico HTTP/1.1", host: "159.65.205.188"

What am I doing wrong? Or what I didn't understand? I would appreciate any response.

Also, my public already contains a favicon file

Thanks

2 Answers2

0

Ok, today I knew that there are two logs. Check /var/log/nginx/error.log I unknowingly and looked only in /var/log/nginx/myapp.error.log

Location of the log file By default, the Passenger log file is the global Nginx error log file. This is one specified by the error_log directive in the main context (that is, not the one inside the http context). The file is typically located in /var/log/nginx/error. log .

0

I faced the same problem and it was resolved by adding the following code segment to the Nginx configuration file nginx.conf

location = /favicon.ico {
  return 204;
  access_log     off;
  log_not_found  off;
}