- sudo apt-get install nginx
- vi /etc/nginx/nginx.conf # observe how the html { } section has: include /etc/nginx/sites-enabled/*;
- vi /etc/nginx/sites-available/foo # build the server { } section
server {
listen 80 default_server;
root /var/www/html/foo;
index index.html
location / {
autoindex on;
auth_basic "Restricted";
auth_basic_user_file /etc/nginx/.htpasswd;
}
}
- # build .htpasswd file
- ln -s /etc/nginx/sites-available/foo /etc/nginx/sites-enabled/foo
- service nginx restart