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

相关推荐
SeaTunnel16 小时前
Apache SeaTunnel 2025 案例精选重磅发布!
大数据·开源·apache·seatunnel·案例
麦兜*21 小时前
Spring Boot 整合 Apache Doris:实现海量数据实时OLAP分析实战
大数据·spring boot·后端·spring·apache
云边有个稻草人1 天前
大数据时代下的时序数据库选型指南:为何Apache IoTDB成为最优解
大数据·apache·时序数据库·apache iotdb
JosieBook2 天前
【数据库】时序数据智能基座:Apache IoTDB 选型与深度实践指南
数据库·apache·iotdb
微学AI2 天前
时序数据库选型操作:Apache IoTDB 的深度实战应用
apache·时序数据库·iotdb
それども2 天前
Apache POI XSSFWorkbook 写入Excel文件的潜在风险
apache·excel
Benny的老巢2 天前
Mac上用XAMPP搭建局域网可访问的开发环境,让局域网内其他设备通过域名访问
nginx·macos·apache·xampp·php开发环境
Maggie_ssss_supp3 天前
Linux-Web服务(Apache)
linux·运维·apache
予枫的编程笔记3 天前
深度解析Apache RocketMQ:从核心原理到实战应用
java·apache·rocketmq
hopsky4 天前
2025 年 Apache DolphinScheduler 案例精选
apache