1、修改配置文件/usr/local/nginx/conf/nginx.conf
指定目录,开启autoindex为on。
location /study {
autoindex on;
}
2、 保存后,重启nginx服务
先检查配置文件有没有问题:
[root@aliyun conf]#/usr/local/nginx/sbin/nginx -t
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
然后重启nginx服务:
[root@aliyun conf]#/usr/local/nginx/sbin/nginx -s reload
经过这两步,便配置成功了!