How do I get a close up subject and a landscape back round both in focus at the same time?

Nick C asked: Example, if you wanted to take a headshot of a person in focus and close up, but you wanted the beach and horizon behind them, all in focus. I see this in magazines, but I can’t do it with my Nikon d60 cause I don’t know what I’m doing. P.S. I [...]