apache共享目录文件配置

httpd配置文件路径

/etc/httpd/conf/httpd.conf

配置单个节点

httpd中原本有一个配置

bash 复制代码
<Directory "/var/www">
    AllowOverride None
    # Allow open access:
    Require all granted
</Directory>

# Further relax access to the default document root:
<Directory "/var/www/html">
    #
    # Possible values for the Options directive are "None", "All",
    # or any combination of:
    #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    #
    # Note that "MultiViews" must be named *explicitly* --- "Options All"
    # doesn't give it to you.
    #
    # The Options directive is both complicated and important.  Please see
    # http://httpd.apache.org/docs/2.4/mod/core.html#options
    # for more information.
    #
    Options Indexes FollowSymLinks

    #
    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All", "None", or any combination of the keywords:
    #   Options FileInfo AuthConfig Limit
    #
    AllowOverride None

    #
    # Controls who can get stuff from this server.
    #
    Require all granted
</Directory>

增加配置的目录

bash 复制代码
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
<IfModule dir_module>
    DirectoryIndex index.html
    Alias /test "/xxx"
    Alias /reports "/xxx1"
    <Directory xxx>
        AllowOverride None
        Options Indexes FollowSymLinks
        Require all granted
    </Directory>
    <Directory xxx1>
        AllowOverride None
        Options Indexes FollowSymLinks
        Require all granted
    </Directory>
</IfModule>

其中xxx是指本地的某个绝对路径映射到http://localhost/test

xxx1是指本地的某个绝对路径映射到http://localhost/reports

配置完成保存

文件名长度配置

httpd apache index 显示文件名长度

通常情况下,文件名过长,打开index后,过长的文件名会最后会显示..

在centos中文件所谓位置etc/httpd/conf.d/autoindex.conf

在配置文件httpd-autoindex.conf中的修改:

bash 复制代码
IndexOptions FancyIndexing HTMLTable VersionSort NameWidth=* FoldersFirst Charset=UTF-8 SuppressDescription SuppressHTMLPreamble

其中

FancyIndexing 支持美化显示;

HTMLTable 允许底层代码把文件列表生成在一个table元素里面;

VersionSort 安装版本排序;

NameWidth=* 页面自动匹配文件名宽度;

FoldersFirst 安装文件夹优先排列;

Charset=UTF-8 支持中文显示;

SuppressDescription 不显示文件描述;

重启

systemctl restart httpd

相关推荐
路baby1 天前
Pikachu安装过程中常见问题(apache和MySQL无法正常启动)
计算机网络·mysql·网络安全·adb·靶场·apache·pikachu
努力打怪升级1 天前
Apache HTTP Server 2.4 Windows 版完整配置与运维手册
运维·http·apache
航Hang*2 天前
第2章:进阶Linux系统——第10节:Linux 系统编程与 Shell 脚本全解笔记(GCC+Make+Vim+Shell Script)
linux·运维·服务器·学习·vim·apache·vmware
倔强的石头1062 天前
时序数据库选型指南:可视化与分析协同怎么选?——以 Apache IoTDB + Grafana + 大数据引擎为例
apache·时序数据库·iotdb
zz0723202 天前
Apache Kafka 开源的分布式事件流平台
分布式·kafka·apache
A-刘晨阳2 天前
流批一体架构下的时序数据库选型:Apache IoTDB实时计算能力深度解析与国际化对比
架构·apache·时序数据库
wei_shuo2 天前
工业物联网数据基础设施:Apache IoTDB 与 TimechoDB 的云原生与 AI 进化之路
物联网·apache·iotdb
橘子编程5 天前
Apache Hadoop知识全解析
大数据·hive·hadoop·apache
zzj_2626105 天前
实验三 循环结构程序设计(Python)
服务器·python·apache
lulu12165440786 天前
谷歌Gemma 4实战指南:Apache 2.0开源,移动端AI新时代来临
java·开发语言·人工智能·开源·apache·ai编程