Thursday, March 3, 2016

Simple authentication for Zeppelin


Step 1: install Nginx 

        $ sudo apt-get install nginx

Step 2: Cerate a user name and password using htpasswd
I am creating the user named guest1

  $ htpasswd -c /etc/nginx/zep/.htpasswd guest1

Ether the password for it

Step 3 : Configuring the Nginx

                $ sudo nano /etc/nginx/nginx.conf

Add the below mentioned lines in the http section

server {
        listen 8080;
        # the port you want Nginx to Listen
        server_name  localhost;
 
        # http://nginx.org/en/docs/http/websocket.html
        location /ws {
            proxy_pass http://localhost:8088/ws;
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "upgrade";
            auth_basic "Restricted";
            auth_basic_user_file /etc/nginx/zep/.htpasswd;
        }
 
        location / {
            auth_basic "Restricted";
            auth_basic_user_file /etc/nginx/zep/.htpasswd;
            proxy_pass http://localhost:8088;
        }
    }

Step 4 : Restart Nginx

               $ sudo service nginx restart