Nginx设置目录浏览

编辑nginx.conf

  • 在server里面增加下列内容:
location /cloud {
	location ~* .*.(txt|sh|py){
 	add_header Content-Type text/plain;
 	}
	alias /home/cloud/;
	auth_basic "Enter your name and password";
 	auth_basic_user_file /usr/share/nginx/mypasswd;
 	charset utf-8,gbk;
 	autoindex on;
 	autoindex_format html;
 	autoindex_exact_size off;
 	autoindex_localtime on;
 	}

猜你喜欢

转载自blog.csdn.net/DMcomming/article/details/85255864