0

I need some help in understanding following log statement found in /var/log/nginx/error log file.

2016/07/28 14:06:05 [error] 7255#7255: *712 open() "/usr/share/www/proj/check_proxy" failed (2: No such file or directory), client: 180.97.xxx.xxx, server: localhost, request: "GET http://180.163.xxx.xxx/check_proxy HTTP/1.1", host: "180.163.xxx.xxx"

How to read above log message? Especially what is server and what is host? Whenever I try to access the site, GET value in log message starts with slash(/) character. But in above log message it shows a URL. How can I reproduce above log message?

Interesting points in above log message are host IP is same as ip address in URL besides GET. nginx conf file doesn't contain localhost server name, yet it appears in server value in above log message. All other log messages show host as IP of machine, and server as server_name from nginx configuration file. Just a few observations based on my limited knowledge.

Thanks very much in advance.

1
  • The server and host in some cases will most likely be the same and will be the name of the server running nginx. If I had to guess your location block in default.conf is incorrect. It would help if you updated your question with what it is you have nginx doing. (your use case) Using it for web server, load balancer? etc..and posting the output your nginx.conf and default.conf.
    – user53029
    Jul 28, 2016 at 21:53

1 Answer 1

2

The server part in the log line is the nginx virtual host server name that processed the request.

If you don't have a server block with server_name localhost, then it uses any server block with default_server attribute.

If you don't have a default_server defined in your nginx configuration, I assume nginx will put localhost in that case.

host is the value of the HTTP/1.1 Host header present in the HTTP request. If you make the request using an IP address, then it is the same as the IP address you use in the URL.

This is only an educated guess, but the fact that the request part contains the full URL of the actual request might be because the request hit the default_server, and therefore it is useful to log the full request URL in order to know which hostname was requested.

Not the answer you're looking for? Browse other questions tagged .