1.Nginx
在相应项目的 Server 段中的 location 段中,添加 autoindex on。例如:
server { listen 80; server_name www.dee.practise.com; location /{ root html/practise; #index index.php; autoindex on; } location ~ \.php$ { #root html; root html/practise; #fastcgi_pass 127.0.0.1:9000; fastcgi_pass unix:/tmp/php-cgi.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } access_log /home/wwwlogs/practise/access.log access; }
2.Apache
在 http.conf 中加入如下代码(以 d:/wamp/www/practise 目录为例):
<Directory "d:/wamp/www/practise"> #开启目录列表索引模式 Options Indexes Order allow,deny IndexOptions NameWidth=25 Charset=UTF-8 Allow from all </Directory>
或
<Directory />"d:/wamp/www/practise" #开启目录列表索引模式 Options Indexes Order allow,deny IndexOptions NameWidth=25 Charset=UTF-8 Allow from all </Directory>
参考:
时间: 2024-12-08 03:36:30