- autoindex on;#开启目录浏览功能
server {
listen 80;
server_name www.shi110.cn;
autoindex on; # 开启目录浏览功能
charset utf-8;#如果出现乱码尝试切换
autoindex_exact_size off;
location ^~ /articleList/ {
alias /usr/local/article/; #部署到centos 末尾要加斜杠
}
如果 directory index of ''/usr/local/article/"" is forbidden 403
需要加权限
1.更改目录所有者命令:
chown -R 用户名称 目录名称
例子:
chown -R root /usr/local/article/
2.更改目录权限命令:
chmod -R 755 目录名称
例子:
chmod -R 755 /usr/local/article/
不要使用777
文章讲述了如何在Nginx服务器配置中启用目录浏览(autoindexon)和设置字符集(charsetutf-8),并提供了处理403Forbidden错误的方法,包括使用chown改变目录所有者及chmod调整权限至755。
641

被折叠的 条评论
为什么被折叠?



