Hawkes process is a class of simple point processes that is self-exciting and has clustering effect. The intensity of this point process depends on its entire past history. It has wide applications in finance, neuroscience and many other fields. In this paper, we study the large deviations for nonlinear Hawkes processes. The large deviations for linear Hawkes processes has been studied by Bordenave and Torrisi. In this paper, we prove first a large deviation principle for a special class of nonlinear Hawkes processes, that is, a Markovian Hawkes process with nonlinear rate and exponential exciting function, and then generalize it to get the result for sum of exponentials exciting functions. We then provide an alternative proof for the large deviation principle for a linear Hawkes process. Finally, we use an approximation approach to prove the large deviation principle for a special class of nonlinear Hawkes processes with general exciting functions.