Purchase the door you want to use as a gate before you set the gate posts. Measure the width of the door with a tape measure and set the posts that distance apart. Add 1/2 inch to provide a gap for easy opening and closing.
Trim the height of the door with a circular saw so it will fit visually with the rest of the fence. If you use a solid-core exterior door with a pattern, trim equal amounts from the top and bottom to preserve the symmetry of the pattern. If you use a door with a solid face, it's only necessary to cut from the top or the bottom.
Chisel three mortises for the hinges on one edge of the door with a chisel if the mortises don't already exist. Screw a door hinge into each mortise with the head of the hinge pin facing up.
Support the door in the gate opening on blocks so the bottom is about 2 inches above the ground. Align the front edge with the front edges of the gate posts. Open the hinges to lie flat against the hinge post and trace their outline with a pencil.
Remove the hinge pins and separate the hinges. Place the free half of each hinge inside one of the tracings and screw it to the post. When all three are attached to the post, support the door in the opening, fit the hinges together and drop in the pins.
Install a lockable doorknob into the pre-existing hole in the door. If there isn't a hole, drill one with a drill and a hole saw. The actual size of the hole you need depends on the doorknob model, which will be specified in the instructions that come with the knob.
Close the door and hold it so the front is flush with the edges of the gate posts. Mark the position of the knob barrel. Open the door and drill a 1-inch hole centered on the center of the barrel. Center a metal door strike on the hole and screw it in place. Close the door and verify that the barrel enters the strike and will keep the door closed.
Cut two pieces of 1-by-2-inch lumber to a length equal to the height of the door. Push one piece flush against the inside edge of the closed door on the knob side and nail it to the gate post with 2-inch finish nails to act as a door stop. Nail the other piece to the gate post on the hinge-side of the door in the same way.
Set the gate posts before you construct the door, because you can make the door any width you choose. Set the posts firmly in concrete or gravel so they don't wobble.
Cut three lengths of 1-inch fencing lumber to the distance between the posts minus 1/2 inch with a circular saw. Use the saw to cut two rectangles from a sheet of 1/2-inch exterior plywood that are the height you want the door. Their width should be equal to the lengths of the fencing boards you just cut.
Screw the three fencing boards to the back of one of the plywood rectangles with 1-inch wood screws. The top edge of one should be aligned with the top of the plywood, the bottom edge of one aligned with the bottom and the third positioned midway between the other two.
Place the other plywood rectangle on top of the three fencing boards. Align it with the other rectangle so all edges are flush. Screw it to the fencing boards with 1-inch screws.
Hang the door with three gate hinges. Space the hinges evenly on the front of the door with the pins flush against the hinge side of the door and screw them to the plywood. Open the hinges so they are flat. Support the door in the fence opening and align the edge with the gate post as you screw the other halves of the hinges to the post.
Screw a gate latch to the opposite side of the door so the latch intercepts the gate post when you close the door. Screw a latch seat to the post to hold the latch. You can also install a doorknob, following the procedure in Section 1.