<Directory /var/www/blog/userfiles/>
#开启目录列表索引模式
Options Indexes
Order allow,deny
IndexOptions NameWidth=250 Charset=UTF-8
Allow from all
</Directory>
参数"Options Indexes"表示启用目录浏览,"IndexOptions Charset=UTF-8"设置字符集,以消除中文乱码,NameWidth=250 :指定目录列表可以显示最长为125字节的文件/目录名。
Apache log:
后来在log中找到如下一行
Directory index forbidden by Options directive: /var/www/html/
google一下,采用了一个高人得建议,删除以下两个页面
rm -f /etc/httpd/conf.d/welcome.conf ← 删除测试页
rm -f /var/www/error/noindex.html ← 删除测试页
再次打开站点,又是报错“You don‘t have permission to access / on this server.”,关了iptables和selinux还是无果,于是动手重启apache,报错
(98)Address already in use: make_sock: could not bind to address [::]:80
(98)Address already in use: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
Unable to open logs
唉,原来进程端口被占用
# ps -aux|grep httpd //找到进程号
# kill -9 xx //杀掉进程XX
# /usr/local/apache2/bin/apachectl -k start //启动apache
启动成功,站点打开成功