location / {
        try_files $uri $uri/ /index.php?$query_string;

        auth_basic            "Restricted Area";
        auth_basic_user_file  /var/www/domainname.com/folder/.htpasswd;
    }