Trying to do the opposite of www.domain.com -> domain.com

mike mike503 at gmail.com
Mon Sep 1 11:29:44 MSD 2008


On 9/1/08, Igor Sysoev <is at rambler-co.ru> wrote:

> Just for info, here is some configuration that returns 404 for any invalid
> hostname if you do not want to associate your site with these names:
>
>     server {
>         listen 80 default;
>         server_name _;
>         return  404;
>     }

this would probably work to log any unknown host headers/missing host
headers, right?

        server {
                listen 80 default;
                server_name _;
                return 404;
                access_log /var/log/nginx/unmapped.log;
                root /htdocs/unmapped/;
        }

another question:

is there any reason to require the ending slash "/" ?
                root /htdocs/unmapped/;
as opposed to:
                root /htdocs/unmapped;

i used to think it was required but it seems to work properly now
without the slash too.





More information about the nginx mailing list