empty reply from server

yellowbox9 nginx-forum at nginx.us
Fri May 6 17:38:46 MSD 2011

I'm setting up a new nginx environment and I'm having issues with 404's.
When I use curl to request a file that I know does not exist, nginx
responds back with an empty reply.... I would prefer a 404 not found
with the correct http status code.

My config:

user nobody;
worker_processes 4;
worker_rlimit_nofile 8192;
        worker_connections 4096;

        include mime.types;
        default_type text/plain;
        log_format nn '$host $remote_addr - $remote_user [$time_local] 
' '"$request" $status $bytes_sent ' '"$http_referer"
        access_log /opt/nginx/logs/access.log nn;
        error_log /opt/nginx/logs/error.log;
        sendfile on;
        keepalive_timeout 0;
                listen 80 default;
                root /opt/nginx/html/;
                index index.html index.htm index.php index.php5;
                include /opt/nginx/conf/location_php.conf;
        include /opt/nginx/conf/vhosts/*.conf;

The html root dir:

bash> ls /opt/nginx/html/
404.html  50x.html  empty.html  foobar  index.html  ping

The curl request:

curl -v http://localhost/index.html2
* About to connect() to localhost port 80
*   Trying connected
* Connected to localhost ( port 80
> GET /index.html2 HTTP/1.1
> User-Agent: curl/7.15.5 (i386-redhat-linux-gnu) libcurl/7.15.5
OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5
> Host: localhost
> Accept: */*
* Empty reply from server
* Connection #0 to host localhost left intact
curl: (52) Empty reply from server
* Closing connection #0

The access log:
localhost - - [06/May/2011:09:35:17 -0400]  "GET /index.html2
HTTP/1.1" 200 0 "-" "curl/7.15.5 (i386-redhat-linux-gnu) libcurl/7.15.5
OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5" - For some reason returning http
status code 200?

The error log:
2011/05/06 09:35:17 [error] 9879#0: *9312 open()
"/opt/nginx/html/index.html2" failed (2: No such file or directory),
client:, server: , request: "GET /index.html2 HTTP/1.1", host:

I don't understand what I'm doing wrong here... any thoughts?

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

More information about the nginx mailing list