最佳答案
当我输入一个 URL http://test.com/test/
时,我曾经看到过这种情况,它不给我一个 html 页面,而是给我一个类似于“文件浏览器”的界面来浏览给定位置的所有文件。
我认为它可能是一个 nginx 模块,可以在位置上下文中启用。
nginx.conf
文件:
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;
}
}
}
更新 error.log
2012/05/1920:48:33[ error ]20357 # 0: * 72 open ()“/home/yozloy/html/test”未通过(2: 没有这样的文件或目录) ,客户端: 125.43.236.33,服务器: 122.97.248.252,请求: “ GET/test HTTP/1.1”,主机: “ unicom2.markson.hk”
我一定是误解了位置 /test
的意思,我以为它的意思是当我键入 http://example.com/test,然后它会访问根字典是 /home/yozloy/html/