Thursday, 6 April 2017

oh2 securtiy

http://docs.openhab.org/installation/security.html

sudo apt-get update && sudo apt-get install nginx
sudo mv /etc/nginx/sites-enabled/default /etc/nginx/sites-enabled/openhab

sudo nano /etc/nginx/sites-enabled/openhab

server {
listen                          [LISTEN_PORT];
server_name                     [mydomain_or_myip];

location / {
proxy_pass                            http://localhost:[LOCAL_PORT]/;
proxy_set_header Host                 $http_host;
proxy_set_header X-Real-IP            $remote_addr;
proxy_set_header X-Forwarded-For      $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto    $scheme;
}
}


sudo nginx -t
sudo service nginx restart


add securiry:

sudo apt-get install apache2-utils

add the following to the previous file:

auth_basic                            "Username and Password Required";
auth_basic_user_file                  /etc/nginx/.htpasswd;


sudo htpasswd /etc/nginx/.htpasswd [USERNAME]

No comments:

Post a Comment