Galvanization is the process by which nails are covered with a zinc alloy. The zinc provides a protective coating that helps prevent the nail from rusting. Most nails that you purchase at a hardware store or that are used in construction are galvanized. This does not mean that the nail will never rust, but that it will have better rust protection than nails that are not covered in a protecting coating. You can galvanize your nails at home if you have the right tools, but it is easier and generally more cost effective to simply purchase galvanized nails.
By covering your nails in petroleum jelly, you are creating a layer of water resistance that can help prevent rust. This solution, however, is not a long-term one. Petroleum jelly has a low boiling point and will therefore melt in the sun. While this will still leave a film of water resistance, scraping, scratching or bumping the nail will eventually pull off all of the petroleum jelly.
Paint companies such as Rust-Oleum specialize in creating paint that can help prevent rust on your painted metal furniture. You can also use this paint to cover your nails and prevent them from rusting. Spray each nail individually with metal primer spray. Make sure that you use primer spray that advertises its ability to prevent rust.