1. 程式人生 > >Nginx設定目錄瀏覽

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;
 	}