nginx - ngnix 上的目录列表
问题描述
嗨,我正在尝试使用 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 已修改
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
解决方案
推荐阅读
- swiftui - SwiftUI - OnDelete 后刷新崩溃
- python - 复数是如何在网上找到的乌拉姆螺旋描绘中绘制为方向向量的?
- swashbuckle.aspnetcore - Swagger.json 生成不正确的大小写“类型”:“字符串”
- python - 使用参数 1 获取类型 Surface 错误。我将如何解决它?
- java - 无法从 Java 应用程序加载 chromedriver
- html - 使用 Flask 将 SQL 查询数据传递到 HTML 表单 - 截断字符串
- node.js - app.all(*) 即使在发布请求时也会返回整个 html
- python - python中的Dateetry tkinter日期格式错误
- python - Python_ 在这段代码中'open(0)' 是什么意思?
- c# - 当程序在 Puppeteer Sharp 中完成时如何阻止浏览器关闭