With the growing popularity of autonomous unmanned aerial vehicles (UAVs), the improvement of safety for UAV operations has become increasingly important. In this paper, a landing trajectory optimization scheme is proposed to generate reference landing trajectories for a fixed-wing UAV with accidental engine failure. For a specific landing objective, two types of landing trajectory optimization algorithms are investigated: i) trajectory optimization algorithm with nonlinear UAV dynamics, and ii) trajectory optimization algorithm with linearized UAV dynamics. An initialization procedure that generates an initial guess is introduced to accelerate the convergence of the optimization algorithms. The effectiveness of the proposed scheme is verified in a high-fidelity UAV simulation environment, where the optimized landing trajectories are tracked by a UAV equipped with an L1 adaptive altitude controller in both the offline and online modes.