Nginx ngnix上的目录列表
您好,我正在尝试使用ngnix上的目录列表功能列出一组PDF 这些文件位于/files 我的dockerfile如下Nginx ngnix上的目录列表,nginx,nginx-location,Nginx,Nginx Location,您好,我正在尝试使用ngnix上的目录列表功能列出一组PDF 这些文件位于/files 我的dockerfile如下 FROM nginx WORKDIR /files COPY pdfs /files/ COPY conf.d/default.conf /etc/nginx/conf.d/ EXPOSE 4200 80 ENTRYPOINT ["nginx", "-g", "daemon off;"] default.conf已
FROM nginx
WORKDIR /files
COPY pdfs /files/
COPY conf.d/default.conf /etc/nginx/conf.d/
EXPOSE 4200 80
ENTRYPOINT ["nginx", "-g", "daemon off;"]
default.conf已被修改
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log /var/log/nginx/host.access.log main;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
}
location /files {
root /files;
autoindex on;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
但是当我击中http://localhost/files,我明白了
404找不到
nginx/1.19.4当您在
位置/uri/prefix{…}
下声明根/some/path
时,通过/uri/prefix/file
请求的任何文件都将在/some/path/uri/prefix
目录下搜索。检查和nginx指令之间的差异。您可以使用别名/文件代码>指令,或者您可以尝试使用根“代码>(我不知道它是否有效,但对我来说应该有效)