server {
listen 80 default_server;
server_name www.b.org;
location / {
root html/b.org;
index index.html;
}
location /download {
root html/b.org;
autoindex on;
}
location /fin {
root html/b.org;
auth_basic "private";
auth_basic_user_file "/etc/.htpasswd";
}
}
htpasswd命令是由apache安装时提供的,如果没有安装apache,则安装apache工具包:httpd-util即可。