我在使用nginx和autoindex时遇到了麻烦。
即使我把它放在网站主机,它仍然扔“403禁止在我身上”
location /pics { autoindex on; }
是我作为一个configuration
server { listen 80; server_name www.domain.com; access_log /home/www/log/access.log; error_log /home/www/log/error.log; location / { root /home/www/public/; index index.html index.php; } location /pics { autoindex on; } }
我已经检查了nginx -v,并且已经用autoindex模块构build了。 只是在这里无知。
在位置设置的根目录不适用于位置/图片,所以如果你检查你的错误日志,你会看到nginx正在寻找/ pics请求的默认根目录。 只要删除位置/并在服务器上下文中设置根和索引指令:
server { root /home/www/public; index index.html index.php; location /pics { autoindex on; } }