Accept all server_name's except empty

Dear all,

How can I set up my nginx configuration file so that it will accept all
request; however it will deny if “host” header is not added?

Also currently I am logging bytes_send per “host” and then take sum of
them with a cron job monthly. Is there a better way to achieve this?

Cheers,
Kaan Yamanyar

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,215685,215685#msg-215685

On Sep 23, 2011, at 11:24 , yamanyar wrote:

Dear all,

How can I set up my nginx configuration file so that it will accept all
request; however it will deny if “host” header is not added?

server {
server_name “”; # no host header field in request
return 444;
}

server {
server_name _;

}

Also currently I am logging bytes_send per “host” and then take sum of
them with a cron job monthly. Is there a better way to achieve this?

Currently no.


Igor S.
http://sysoev.ru/en/

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs