Nginx returns 404 on files with special characters

nginxwindows-server-2008-r2

I just switched over to nginx as a static file server and it works for the vast majority of files but it's throwing a 404 on certain files with special characters.

This is Kevin Worthington's 64 bit build of nginx running on Windows Server 2008 R2.

My nginx.conf entry looks like this…

server {
    server_name  example.com;

    listen       80;

location /static/ {
root /cygdrive/g/Files;
expires 30d;
}

    location / {
        proxy_pass   http://127.0.0.1:8080;
    }
}

The entry in the error log is as follows…

recvmsg() returned invalid ancillary data level 19 or type 8
2011/08/19 19:04:22 [error] 3756#0: *1 open()
"/cygdrive/g/Files/static/Pilón.jpg" failed (2: No such file or
directory), client: 12.168.24.203, server: example.com, request: "GET
/static/Pil%F3n.jpg HTTP/1.1", host: "example.com"

If I grab the path referenced in the error, swap the slashes for backslashes and toss a colon in there for good measure then windows will open the file from the run menu. Other files in the same folder but not containing special characters work just fine.

Best Answer

It seems there is a bug with unicode characters in windows versions of nginx. There is some workaround proposed in nginx maillist, try it.

Related Topic