This paper presented an efficient finite element formulation for analysis of the buckling and free vibration of the axial functionally graded (AFG) Euler-Bernoulli nanobeam based on minimum total potential energy principle with linear constraints. The stress- and strain-driven two-phase local/nonlocal integral models are utilized to address small scale effects. The material properties of the AFG nanobeam vary exponentially along the axial direction. The nonlocal integral constitutive equation can be equivalently transformed into a differential equation with two constitutive boundary conditions. The governing equation and standard boundary conditions are derived via Hamilton's principle. The weak form associated with total potential energy is derived and the constitutive boundary conditions can be converted to external forces at the boundaries. By employing a numerical solution methodology on the basis of the finite element method (FEM) together with Lagrangian multiplier method (LMM), a unified finite element formulation based on stress- and strain-driven two-phase local/nonlocal elasticity is constructed to obtain the critical buckling load and vibration frequency. Meanwhile, the numerical results obtained through generalized differential quadrature method (GDQM) validate the efficiency and accuracy of the present results. The influence of gradient index, nonlocal parameter and local phase parameter on buckling and free vibration of AFG Euler-Bernoulli nanobeam is investigated in detail under different nonlocal models and boundary conditions. It is demonstrated that the gradient index has more effect on mode shapes than the buckling load and vibration frequency between the local stress- and strain-driven two-phase local/nonlocal models.