Origin of the expression 'hard by'?
Solution 1:
Hard by can be used both as a preposition and an adverb. The OED’s earliest recorded use as the former is from 1526. Its meaning is ‘Close by; in close proximity to; close to, very near to’ and it is described as somewhat archaic.
As an adverb, it is first recorded nine years later, with the similar meaning ‘In close local proximity; close by, very near’.
The adverb hard can mean ‘In close proximity, of time or place’ on its own, and is first recorded in that sense in the fifteenth century, but such use may now be infrequent.
Solution 2:
The American Heritage Dictionary of Idioms give this example: "Their house was hard by ours". I'd replace it with close to rather than close by (American English).
[Edit: The book is viewable on Amazon.com, but the page with this entry isn't part of the preview. I found that at http://books.google.com.tw after doing a search on Google Ngrams viewer for "hard by" and clicking on the "hard by" option.]
[Edit: It's under the entry hard on 1. Also, hard upon, hard by. In close proximity, as in The police were hard on the heels of the thieves, or It was hard upon three o'clock, or Their house is hard by ours. The variants are used less than hard on. [Second half of 1700s]]
Solution 3:
I'm going to re-offer the likelihood of a nautical origin. Sailing "hard by" a buoy means sailing close to it. "Hard up" means sailing close to the wind. "Hard-a-lee" means to push the tiller hard to the leeward side.