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

相关推荐
大风吹PP凉36 分钟前
34Web服务器(如Apache, Nginx)
服务器·nginx·apache
巨大八爪鱼14 小时前
XP系统下用mod_jk 1.2.40整合apache2.2.16和tomcat 6.0.29,让apache可以同时访问php和jsp页面
java·tomcat·apache·mod_jk
运维佬1 天前
在 Linux 系统上部署 Apache Solr
linux·apache·solr
小蒜学长2 天前
校园周边美食探索及分享平台
java·spring boot·后端·spring·apache·美食
დ旧言~2 天前
【网络】子网掩码
服务器·网络·网络协议·tcp/ip·php·apache
Ops菜鸟(Xu JieHao)2 天前
Dockerfile构建镜像(练习一Apache镜像)(5-1)
服务器·docker·容器·apache·脚本·dockerfile·系统运维
Percep_gan2 天前
Apache服务安装
apache
阿里云大数据AI技术2 天前
Apache Spark & Paimon Meetup · 北京站,助力 LakeHouse 架构生产落地
大数据·架构·spark·apache
程序员入门进阶3 天前
智能社区服务小程序+ssm
小程序·apache
编码小袁3 天前
探索Apache Spark:现代数据处理的闪电利剑
大数据·spark·apache