Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I setup Nginx to server multiple websites from a single virtual host by doing this (A Default Catchall Virtual Host):

server {  
    listen   80 default;
    server_name  _;

However, my access logs are recording "_" instead of the site's domain name. How can I configure Nginx to record the host? - - [31/Aug/2011:01:32:17 +0000] "GET /?p=12 HTTP/1.1" 200 2820 "-" "Mozilla/5.0 (compatible; Baiduspider/2.0; +"
share|improve this question

1 Answer 1

up vote 8 down vote accepted

After reading the docs a second time I realized that the "_" is the referer.

I ended up going with:

log_format timed_combined '$remote_addr - $remote_user [$time_local]  '
                '"$request" $status $body_bytes_sent '
                '"$http_referer" "$http_user_agent" "$host" $request_time';

Which appends the host and the time the request took to process to the end of the log.

share|improve this answer
You'd now use it like this: access_log /var/log/nginx/access.log timed_combined; – Hengjie Jan 2 '13 at 21:54

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.