625 bytes added
, 14:16, 9 March 2018
== Password protected ==
Create a /etc/nginx/.htpasswd
<source lang="bash">sudo sh -c "echo -n 'sammy:' >> /etc/nginx/.htpasswd"
sudo sh -c "openssl passwd -apr1 >> /etc/nginx/.htpasswd" # you will be prompt for password</source>
sudo nano /etc/nginx/sites-enabled/default
<nowiki>server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
root /usr/share/nginx/html;
index index.html index.htm;
server_name localhost;
location / {
try_files $uri $uri/ =404;
auth_basic "Restricted Content";
auth_basic_user_file /etc/nginx/.htpasswd;
}
}</nowiki>