The exact method is
1) Create an .ico (icon file). There are sites which can give you icon files from you main logo in minutes but they are not that good. Suggest you to custome made icon file from some designer as per your requirement.
2) The suggested size of this icon is 16X16 OR 32X32.
3) Upload the icon file on you main directory or else you can create seperate directory for this icon.
4) Use following HTML code in the <HEAD> </HEAD> tag of the main template of the site.
If the icon is placed in main directory of the site
<link rel="shortcut icon" href="logo.ico">
If the icon is placed in some other sub-directory
<link rel="shortcut icon" href="/folder-name/logo.ico">
I will prefer to use full path for the icon file
<link rel="shortcut icon" href="http://www.your-site-name.com/logo.ico">
<link rel="shortcut icon" href="http://www.your-site-name.com/folder-name/logo.ico">
Hope this helps you.