Once I’ve seen this before when I type a URL http://test.com/test/, instead of give me a html page, it gives me a ‘file browser’ like interface to browse all the files in the given location.
I think it maybe a nginx module that could be enable in the location context.
The nginx.conf file:
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name 122.97.248.252;
location /test {
root /home/yozloy/html/;
autoindex on;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
update the error.log
2012/05/19 20:48:33 [error] 20357#0: *72 open() “/home/yozloy/html/test” failed (2: No such file or directory), client: 125.43.236.33, server: 122.97.248.252, request: “GET /test HTTP/1.1”, host: “unicom2.markson.hk
I must misunderstand the location /test mean, I thought it meant when I type http://example.com/test, then it would access the root dictionary which is /home/yozloy/html/
You should try ngx_http_autoindex_module.
Set
autoindexoption toon. It isoffby default.Your example configuration should be ok
Without
autoindexoption you should be getting Error 403 for requests that end with/on directories that do not have anindex.htmlfile. With this option you should be getting a simple listing:Edit: Updated the listing to delete any references to test