Phase-matched second-harmonic generation (SHG) under the Bragg diffraction in the Laue geometry in one-dimensional photonic crystal (PhC) is studied theoretically and experimentally. We demonstrate that the phase-matched SHG can be realized in a PhC by compensation of the material dispersion of the PhC constituent layers of adjustable thickness. The second-order nonlinear susceptibility is introduced in the porous quartz-based PhC by its infiltration by sodium nitrite. We observed that two second-harmonic (SH) beams appear after passing through the PhC under the phase-matched process, which correspond to the transmission and diffraction angular directions. The appearance of the phase-matched SHG is confirmed by a pronounced SH spectral dependence and a narrow SH angular distribution, with the FWHM of the SH peak of approximately 3.5 times smaller as compared to the case of non-phase-matched SHG.