We present the experimental realization of nanofiber Bragg grating (NFBG) by drilling periodic nano-grooves on a subwavelength-diameter silica fiber using focused ion beam milling technique. Using such NFBG structures we have realized nanofiber cavity systems. The typical finesse of such nanofiber cavity is F ∼ 20 - 120 and the on-resonance transmission is ∼ 30 - 80%. Moreover the structural symmetry of such NFBGs results in polarization-selective modes in the nanofiber cavity. Due to the strong confinement of the field in the guided mode, such a nanofiber cavity can become a promising workbench for cavity QED.