The halachah requires the mezuzah to go on the outer tefach (four and one half inches) of the doorway. There are two possible reasons why this is so. One is so that the entire house is protected. The other is so that we come into contact with the mitzvah at the earliest point in time. When the door in question is an outer door the custom is to put it on the outermost spot (unless it will be heavily rained upon). On the inside doorways, since they are already protected by the mezuzos that are on rooms that are closer to the outside of the house, the minhag (custom) is to put it on the middle of the door frame.