0%

http服务器目录显示不全解决

问题现象

搭建了 Apache httpd.service 服务,文件名显示不全。

image-20250122192010737

解决方法

  • 修改/etc/httpd/conf.d/httpd-autoindex.conf 配置文件,内容改成如下
1
IndexOptions FancyIndexing HTMLTable VersionSort NameWidth=* FoldersFirst Charset=UTF-8 SuppressDescription SuppressHTMLPreamble
  • 如果/etc/httpd/conf.d/目录下没有httpd-autoindex.conf 配置文件,可以在系统上find一下
image-20250122155326037
  • 将配置文件httpd-autoindex.conf 拷贝到/etc/httpd/conf.d目录下。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
# 支持美化显示
FancyIndexing
# 允许底层代码把文件列表生成在一个table元素里面;
HTMLTable
# 安装版本排序
VersionSort
# 页面自动匹配文件名宽度
NameWidth=*
# 安装文件夹优先排列
FoldersFirst
# 支持中文显示
Charset=UTF-8
# 不显示文件描述
SuppressDescription
小主,路过打个赏再走呗~