只需要在location块中,root 指定 路径即可,无需类型什么的;
autoindex on;是是否可以列表形式浏览文件夹里面的文件;
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
client_max_body_size 100m;
server {
listen 89;
server_name json;
charset utf-8;
#配置跨域
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Methods GET,POST,OPTIONS;
add_header Access-Control-Allow-Headers Content-Type,Authorization;
location / {
root D:/laterdata/;
autoindex on;
}
}
}
然后,浏览器访问 IP:(listen监听的端口)/ 即可!!