【Apache学习】linux文件目录以网页列表形式访问
2015-08-04 11:08
836 查看
想要做出阿里云镜像站这样的效果,要怎么实现呢?
现在,要列出/var/www/html目录下的所有文件
1、首先,需要安装Apache httpd服务
yum install -y httpd
2、查看httpd主配文件
vim /etc/httpd/conf/htpd.conf
确定DocumentRoot为/var/www/html
确保<Directory "/var/www/html">块中Options Indexes打开
Options (页面如何展示给用户看)
Indexes: 当访问的路径下无默认的主页面时,将所有资源以列表形式呈现给用户;危险,慎用;
FollowSysLinks:跟随符号链接指向的原文件;
3、浏览器访问服务器
此时显示的是Apache欢迎界面
4、去除欢迎界面
将welcome.conf重命名.bak,这样就不会再显示Apache欢迎界面了。[root@www conf]#mv /etc/httpd/conf.d/welcome.conf /etc/httpd/conf.d/welcome.conf.bak虽然是重命名配置文件,也属于修改配置文件,需要重载服务[root@www conf]#service httpd reloadReloading httpd:5、在文件夹下制作一点文件,并再次访问[root@www /]# cd/var/www/html/[root@www html]#lsinde.html[root@www html]#touch aa bb cc dd确保该目录下没有index.html文件,否则就会展示index.html
想要其他目录实现这个功能,可以通过修改httpd主配文件实现。
Done!
本文出自 “Adela” 博客,请务必保留此出处http://adelazhu.blog.51cto.com/9455045/1681512
现在,要列出/var/www/html目录下的所有文件
1、首先,需要安装Apache httpd服务
yum install -y httpd
2、查看httpd主配文件
vim /etc/httpd/conf/htpd.conf
确定DocumentRoot为/var/www/html
确保<Directory "/var/www/html">块中Options Indexes打开
Options (页面如何展示给用户看)
Indexes: 当访问的路径下无默认的主页面时,将所有资源以列表形式呈现给用户;危险,慎用;
FollowSysLinks:跟随符号链接指向的原文件;
3、浏览器访问服务器
此时显示的是Apache欢迎界面
4、去除欢迎界面
将welcome.conf重命名.bak,这样就不会再显示Apache欢迎界面了。[root@www conf]#mv /etc/httpd/conf.d/welcome.conf /etc/httpd/conf.d/welcome.conf.bak虽然是重命名配置文件,也属于修改配置文件,需要重载服务[root@www conf]#service httpd reloadReloading httpd:5、在文件夹下制作一点文件,并再次访问[root@www /]# cd/var/www/html/[root@www html]#lsinde.html[root@www html]#touch aa bb cc dd确保该目录下没有index.html文件,否则就会展示index.html
想要其他目录实现这个功能,可以通过修改httpd主配文件实现。
Done!
本文出自 “Adela” 博客,请务必保留此出处http://adelazhu.blog.51cto.com/9455045/1681512
相关文章推荐
- exception in thread main org.apache.spark.sparkexception:A master URL must be set in your
- Visual Studio 2013搭建phoneGap(Apache Cordova)开发环境
- Apache Traffic Server 简介
- apache commons collections CollectionUtils工具类简单使用
- Apache DS UML
- Apache服务器配置多个虚拟主机
- 学习 Apache 的一些心得体会[转]
- Apache虚拟主机配置,实现多域名访问本地项目PHP空间,以及配置403Forbidden等错误的解决办法
- PHP + Apache 配置
- 分布式日志收集系统Apache Flume的设计详细介绍
- Apache的prefork模式和worker模式
- fedora下安装apache过程实录
- Apache优化:修改最大并发连接数
- Apache -- 压力测试工具ab.exe
- Apache Mina - 简单的服务端和客户端的搭建
- apache 配置
- Apache Commons 工具包
- Apache的RewriteRewriteRule ^/t_(.*).html$ /test.php?id=$1 学习
- 阿里云Ubuntu系统+Apache2+PHP搭建gitblog
- Apache 多网站配置