how to protect a django web app deployed in elastic beanstalk docker nginx using password

I’ve a django web application hosted in AWS Elastic Beanstalk with Docker and Nginx. I am using supervisor to start nginx and uwsgi. Need to protect it the website using password. I’ve tried using .htaccess.

htpasswd -cb /etc/nginx/.htpasswd admin admin 

and added the nginx config with

  • Docker: exposed ports cannot be accessed in another container
  • How to connect Emacs' Elpy in-buffer python interpreter to docker container?
  • nginx test failing with different configuration file
  • Getting 502 Bad Gateway while running the Django application within a docker container?
  • Django - default port 0 instead of 3306 - Can't connect to MySQL server on '127.0.0.1' (61)
  • Have created a docker that installs nginx, python, uwsgi and django. How do I test it within a VM?
  •  location / {
    
       auth_basic "Restricted";
       auth_basic_user_file  /etc/nginx/.htpasswd;
       uwsgi_pass unix:/var/sockets/api.sock;
       include    /home/docker/uwsgi_params; 
    }
    

    It’s working but its asking password repeatedly. Usually htaccess only asks password once in session. But it asks for username and password every time we click one field or button. Is there any way to fix it?

  • What is the created time in docker images command?
  • docker like “links” on Kubernetes
  • docker container exited immediately after python script execution
  • docker ps -a not showing my container
  • Unable to start docker on win 10 VM
  • How to connect docker containers in separate deployments on the same host machine using docker-compose?
  • Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.