This is a rack for 14floz/398ml cans I designed to fit behind a door. The uprights should be 2 3/4 inch deep, and the rails are 3/4 inch square. The height of the uprights and width of the rails will depend upon your space. You want to make sure the uprights line up with the studs in the wall as there will be a lot of weight in the cans. The spacing between the rails should be slightly more than the diameter of a can. 3 inch gap is ideal, I tried to make mine tighter and had to shave off a few rails to make the opening large enough. You also don't need a top rail.
I used leftover pine boards from building shelving for my place, but any wood would work. Measurements could be expanded to build a rack for larger cans as well.