In this paper, we solve numerically a class of fractional optimal control problems in the conformable sense. We first propose a nonlinear fractional optimal control problem subject to general equality and inequality constraints. Then, based on a novel numerical integration scheme, we present a discretization method for the governed fractional-order system as well as the cost and constraint functionals, which yields a discretized approximate problem. We further derive the gradients of the cost and constraint functionals in regard to the discretized controls. On the basis of this result, a numerical optimization approach to solve the approximate problem is developed. Finally, three non-trivial example problems are solved to illustrate the applicability and effectiveness of the developed approach.