Based on quasinormal-mode theory, we propose a novel approach enabling a deep analytical insight into the multi-parameter design and optimization of nonlinear photonic structures at subwavelength scale. A key distinction of our method from previous formulations relying on multipolar Miescattering expansions is that it directly exploits the natural resonant modes of the nanostructures, which provide the field enhancement to achieve significant nonlinear efficiency. Thanks to closedform expression for the nonlinear overlap integral between the interacting modes, we illustrate the potential of our method with a two-order-of-magnitude boost of second harmonic generation in a semiconductor nanostructure, by engineering both the sign of χ (2) at subwavelength scale and the structure of the pump beam.