apache 展示 特定Linux目录

vi /etc/httpd/conf/httpd.conf

Listen 80 #apache 访问端口

DocumentRoot "/home/dir" #目录


<Directory "/home/dir">
#
# 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>

 

按照上述配置完,然后需要修改取消一下欢迎界面

mv /etc/httpd/conf.d/welcome.conf /etc/httpd/conf.d/welcome.conf_bak

给展示目录赋权

chmod -R 700 /home/dir

重启httpd服务

service httpd restart

浏览器访问ip:port试一下

posted @ 2021-05-27 10:59  小清澈  阅读(51)  评论(0编辑  收藏  举报