现在,要列出/var/www/html目录下的所有文件
1、首先,需要安装Apache httpd服务
Apache可以用下面的命令来安装
sudo apt-get install apache2
sudo apt-get install apache2
Apache默认路径是/var/www/
其配置文件路径为: /etc/apache2/
可以通过:sudo vi /etc/apache2/ports.conf修改监听端口号
重启服务生效:sudo service apache2 restart
确定DocumentRoot为/var/www/html
确保<Directory "/var/www/html">块中Options Indexes打开
Options (页面如何展示给用户看)
Indexes: 当访问的路径下无默认的主页面时,将所有资源以列表形式呈现给用户;危险,慎用;
FollowSysLinks:跟随符号链接指向的原文件;
Indexes: 当访问的路径下无默认的主页面时,将所有资源以列表形式呈现给用户;危险,慎用;
FollowSysLinks:跟随符号链接指向的原文件;
将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 reload
Reloading httpd:
5、在文件夹下制作一点文件,并再次访问
[root@www /]# cd/var/www/html/
[root@www html]#ls
inde.html
[root@www html]#touch aa bb cc dd
确保该目录下没有index.html文件,否则就会展示index.html
想要其他目录实现这个功能,可以通过修改httpd主配文件实现。
没有评论:
发表评论