nginx - 403 尝试列出 Nginx 目录时
问题描述
我正在尝试使用 nginx 和 fancyindex 来托管具有样式的目录。但是,当我尝试查看目录时,出现 403 错误。我可以查看文件(如果存在),而不是没有 index.html 的目录(如果确实有 index.html,则显示该文件而不是目录)。
我检查了目录的权限,目录及其所有内容都是 777。用户是 root(因为它是从 docker 容器托管的,特别是 image byjg/nginx-extras
)。
我在做什么错才能得到 403 错误?
我的默认.conf:
server {
listen 80 default_server;
root /var/www/html;
index index.html;
server_name web.example.com;
autoindex on;
location / {
#try_files $uri $uri/ =404;
allow all;
autoindex on;
fancyindex on;
fancyindex_localtime on;
fancyindex_exact_size off;
fancyindex_header "/theme/header.html";
fancyindex_footer "/theme/footer.html";
fancyindex_ignore "theme";
fancyindex_name_length 255; # Maximum file name length in bytes, change as you like.
}
}
解决方案
推荐阅读
- sql - 在 SQL 中连接三列
- javascript - 反应倒计时重置
- swift - 嵌入到 NavigationLink 时,如何防止所有子视图都显示为蓝色?
- haskell - Data.Typeable.cast 到存在类型
- javascript - Webm 自动播放不播放
- c# - WiX & Topshelf - 在安装更新/升级之前无法卸载服务
- r - 根据R中跨变量的匹配数据组合进行过滤
- python - 使用 seaborn 绘图时转换 pandas 列中的数据类型
- slack-api - 无法获得 Slack 机器人令牌 (xoxb)
- javascript - Expo Start 自动打开 Webpack 服务器,而不是在 expo App 中打开