We consider a general two-dimensional gravity model minimally or nonminimally coupled to a scalar field. The canonical form of the model is elucidated, and a general solution of the equations of motion in the massless case is reviewed. In the presence of a scalar field all geometric fields (zweibein and Lorentz connection) are excluded from the model by solving exactly their Hamiltonian equations of motion. In this way the effective equations of motion and the corresponding effective action for a scalar field are obtained. It is written in a Minkowskian space-time and does not include any geometric variables. The effective action arises as a boundary term and is nontrivial both for open and closed universes. The reason is that unphysical degrees of freedom cannot be compactly supported because they must satisfy the constraint equation. As an example we consider spherically reduced gravity minimally coupled to a massless scalar field. The effective action is used to reproduce the Fisher and Roberts solutions.