Solution:
header.php is included in each page, you can check with this get_current_user_id(); this function returns 0 if not any user in logged in.
in header.php
<?php
if( !get_current_user_id() && !preg_match('/login/', $_SERVER['REQUEST_URI'])){ // checks if the user is not logged in and the page is not login page,
// redirect to some other page,
header("Location: ". site_url().'/wp-login/' ); // redirecting to login page
exit()
}
?>