apache遍历目录的配置方法

实现目录遍历,如下图结果所示:

centos:

vim /etc/httpd/conf/httpd.conf

添加以下代码,注意红色需要修改为自己的真实目录

Listen 8088

#NameVirtualHost *:8088

<VirtualHost *:8088>
 DocumentRoot /var/www/html
 ServerName 192.168.0.30:8088

Alias /var/www/html/1234 "/var/www/html/1234"
 <Directory "/var/www/html/1234">
 Options Indexes
 Order allow,deny
 IndexOptions Charset=UTF-8
 Allow from all
 </Directory>

</VirtualHost>

 

ubuntu:

vim /etc/apache2/ports.conf

Listen 8089

vim /etc/apache2/sites-available/000-default.conf

添加以下代码,注意目录需要修改为自己的真实目录

<VirtualHost *:8089>

ServerAdmin webmaster@localhost
 DocumentRoot /var/www/html

ErrorLog ${APACHE_LOG_DIR}/error.log
 CustomLog ${APACHE_LOG_DIR}/access.log combined

Alias /var/www/html/1234/ "/var/www/html/1234/"
 <Directory "/var/www/html/1234/">
 Options Indexes
 Order allow,deny
 IndexOptions Charset=UTF-8
 Allow from all
 </Directory>

</VirtualHost>

 

 

发表评论

1,173 次浏览