The invention provides a GaN semiconductor-based ultraviolet (UV) detector structure, from the substrate up, in sequence comprising n-type contact layer, light absorbing layer, light transmitting layer and p-type contact layer, all made of AlGaInN tetra-compound semiconductor material. By changing Al, Ga and In compositions of the semiconductor material, on one hand, these semiconductor layers can possess the needed energy gap, thus able to be specially sensitive to the optical reaction with respect to specific-wavelength UV; on the other hand, these semiconductor layers can possess matching crystal lattice constants, thus able to avoid the related problem of overlarge stress and simultaneously obtaining a UV detector with higher-quality crystal lattice structure. And the structure further comprises anode on the p-type contact layer, light transmitting Ohm contact layer and anti-reflecting layer as well as cathode on the n-type contact layer.