We investigate the thermal entanglement of a two-qubit anisotropic Heisenberg XYZ model with both uniform and nonuniform magnetic fields in the x-z plane at thermal equilibrium. For the uniform magnetic field case, it is shown that the value of the critical magnetic field B(subscript c) may be broadened by changing the direction of the magnetic field and that the revival of entanglement is due to the combined influence of the magnetic field and the Heisenberg model's partial anisotropy in the plane which is perpendicular to the magnetic field. Moreover, the direction of the magnetic field will have an effect on the critical temperature T(subscript c) only when the field strength is large enough. For the nonuniform magnetic field case it is found that, for any direction of the magnetic field, the introduction of inhomogeneity in the magnetic field always broadens the critical magnetic field B(subscript c), but diminishes the maximum entanglement.